Jump to content
  • Advertisement
Sign in to follow this  
Andreas Persson

Need help with D3DXIntersect

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

Hi I´m working on a racing game and I am using D3DXIntersect to make sure the car stays on the ground. But the problem is D3DXIntersect never returns a hit. The road is scaled to 0.1 can that have something to do with it? The road mesh have normals so that´s not a problem. Anyway I don´t know what to do. Is there any other way to do something like this?

Share this post


Link to post
Share on other sites
Advertisement
If you draw a mesh with a specific world space transform, and you have a ray in world space you want to test against the mesh, you have to apply the inverse of the world transform to the ray before you test against the mesh.

To do that:
1) calculate the inverse of the world matrix for the mesh
2) apply the inverse to the position of the ray as transforming a point (with translation)
3) apply the inverse to the direction of the ray as transforming a vector/normal (without translation)
4) pass the transformed ray to the intersection routine

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!