Archived

This topic is now archived and is closed to further replies.

X,Y (Cursor) to 3D Object Detection?

This topic is 6364 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Could someone explain the basics involved in translating a X,Y coord to a 3D object. Basically I''m thinking of creating a vector (not sure how) based on the viewpoint and the cursor and seeing if that intersects the object. Any info would be appreciated. Thanks, Balrin

Share this post


Link to post
Share on other sites

Try shooting a ray from the origin (0,0,0) to (x,y,z) where x and y are mouse co-ordinates, and z is some constant value into the screen. Check all polys that the ray intersects, and find the closest. I don''t know it off-hand, but I know there are a number of good algorithms in the Graphics Gems series for ray-triangle intersection tests. If you''re using a BSP tree, you may be able to discard any nodes that can not possible be hit by the ray.

Share this post


Link to post
Share on other sites