• Advertisement

Archived

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

Mouse Position to 3D position...Help please

This topic is 5681 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

I''m trying to convert the mouse screen position to a 3d world position, ie. use the mouse and select a point in a 3d world. Can someone please point me in the right direction. Thanks

Share this post


Link to post
Share on other sites
Advertisement
you cant really convert a 2D coordinate into 3D... what you want to do is called Picking (which finds a 3D object, that is projected onto a mouse position)...Should look up that term in tutorials/books for API you are using..

Share this post


Link to post
Share on other sites
What you need to do is back-project your screen point to the view plane. The you use the camera location and this back-projected point to create a vector that can be used to fire a ray accross your world, use bounding boxes and polygon\line intersection to find where the ray intersects with an object. I am writing a model\level editor for a game I am created at Reality Creations, and I did it this way, just make sure that you get your sorting order right, I perpetually built a rough BSP (slow on some machines, but the machines we use for editing are good enough), I then use the BSP to ensure that I only find an intersection with the closest surface\point\whatever.

Share this post


Link to post
Share on other sites

  • Advertisement