Sign in to follow this  

Need help with D3DXIntersect

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

This topic is 4359 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this