Sign in to follow this  
jad_salloum

intersecting ray with scaled, rotated, translated mesh (Solved)

Recommended Posts

hi guys i have a ground mesh so what i did is i scaled it to 8 times and rotated it and then translated it to a new location . a car is moving on this ground so i am applying mesh.intersect to see if the car is on the ground and i am putting the location of the car center and with a direction downwards but i am not getting any intersection information. and the hit flag is false eventhough the car is on the ground . so how i can tell this mesh.intersect to use the new scaled, rotated, translated position of the ground to test on it if there is intersection or not ???? [Edited by - jad_salloum on November 29, 2005 2:46:45 AM]

Share this post


Link to post
Share on other sites
Since the intersect function accesses the model space vertices of the mesh, you must supply the ray to be tested in model space as well. That means that you must transform your world-space ray by the inverse of the matrix used to transform your terrain. Use the D3DXVec3TransformCoord and D3DXVec3TransformNormal functions to do this.

neneboricua

Share this post


Link to post
Share on other sites

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