Jump to content
  • Advertisement
Sign in to follow this  
JasonBaldwin

[SOLVED]Testing collision between mouse and 3D geometry

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

Im not sure how i can use a 2d point (ie the mouse position) to test if it intersects with 3D geometry. Any links to tutorials or information on how to do this would be appreciated. Thanks [Edited by - JasonBaldwin on October 12, 2008 2:05:44 PM]

Share this post


Link to post
Share on other sites
Advertisement
You can get the direction into the 3D-world for each point on your screen. So you end up with a line from your camera position, in some direction, and you can intersect-test that line with your geometry. Also, if you have already drawn your geometry, you can use the z-value in the depth-buffer to directly un-transform a 2D-point to the 3D-point visible at that point on the screen.
If you tell us which API you use, and how you store your matrices, it will be easier to tell you more exactly.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!