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

Started by
1 comment, last by jad_salloum 18 years, 4 months ago
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]
Advertisement
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

thanks alot neneboricua19 it worked very good ;p

This topic is closed to new replies.

Advertisement