This topic is now archived and is closed to further replies.


Problem with ray casting and meshes

Recommended Posts

sandy    100
Hi. I''m having a little trouble with ray-to-mesh intersection. I have a mesh in 3D space and I''m trying to check if a ray intersects the mesh using D3DXIntersect(). The problem is that the ray intersection only works when the mesh is at the origin (i.e. 0.0f, 0.0f, 0.0f). If I move the mesh to a new position in the world, the intersection check doesn''t work. For some reason it still thinks the mesh is at the origin as the intersection will work there even after the mesh has moved! I am almost 100% certain that my code for casting the ray is correct as I have used it in other situations, and it has worked fine. I think there must be a problem with the mesh when it moves. The graphical display of the mesh is moving, but as far as D3DXIntersect() is concerned, the mesh is still at the origin. I am just wondering if anyone has seen a similar problem before, or if you have any ideas about what might be causing this to happen. Thanks.

Share this post

Link to post
Share on other sites