Mar 19, 2009 at 1:53 AM
Is there anything build in for Picking?  I didnt see anything at first glance, and I don't mind writing something myself.  Just didn't want to write something that already exists.

Mar 19, 2009 at 1:56 AM
No there isn't. It's something I feel is very application specific, as there are many, many different situations and applications where picking might be required.
Trying to shoe horn in a one-size fits all solution would cause way more trouble than it's worth - and it'd be crazy difficult too :D
Mar 19, 2009 at 1:57 AM
Well I guess I meant more for just casting a ray.  I miss-worded that post :)
Mar 19, 2009 at 2:00 AM
If you want to work out where the ray is traveling, then yes, DrawState has Project to/from screen methods.
Mar 19, 2009 at 2:02 AM
Thats what I was looking for, thanks.  Can't believe I missed that. 
Mar 19, 2009 at 2:04 AM
The only problem now is how do you get the mouse coordinates from the DrawState?   Looks like you can only get them on an Update.
Mar 19, 2009 at 2:11 AM
Yes, it does make sense to have access to them in Update. However there isn't any code to do that right now.
It would make sense to put something similar in the Camera classes.

You can look at the methods in DrawState. They use some tricks to get the view*projection matrix (ProjectFromScreen needs the inverse view*projection), etc, but they should be fairly straight forward. Making your own method that uses an ICamera to get the view*projection matrices and passing in the size of the render target instead shouldn't be too difficult.

Good luck :-) I'll look at adding something similar in the next release.

Mar 19, 2009 at 6:20 PM
state.ProjectFromScreen causes a NullReference exception because DrawTarget and Camera are both null.
Mar 19, 2009 at 9:24 PM
Any method that accesses the camera or the current draw target must be called in a valid context, that is, you must be drawing to something when you call them.
There certainly could be more useful error reporting in such a case.