Jump to content
  • Advertisement
Sign in to follow this  
cistar

Point Sprite Collision

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

The Main Idea is selecting point sprites in a 3d scene with a 2d mouse click. What I have are point sprites representing objects in 3D space. All the point sprites point to the camera at all times, so the ones that are on the screen all have vectors pointing towards the camera point. I also have a normal pointing out of the camera. So for the point sprite that is clicked on to be selected it must have a vector equal and opposite to the camera normal at least in direction. The only thing is, to get the 'closest' sprite means I have to get the 3D position of the sprite to translate to the 2D plane of the camera, I do this because I want the sprite clicked on in the 2D plane of the camera rather then the closest sprite to the camera in 3-space. So first is any of this sound, will it work? Second, how would I go about translating the sprite position to the camera plane?

Share this post


Link to post
Share on other sites
Advertisement
Moved to Maths & Physics for furthe discussion

You can use functions like D3DXVec3Unproject() and D3DXVec3Project() to move from world-space to screen-space and vice versa. They basically boil down to 4 simple matrix multiplications...

Cheers,
Jack

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!