Archived

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

How do I implement collision detection between a loaded mesh and my view cam?

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

I''m playing around with DirectX 8 and can''t seem to figure out how to implement a simple collision detection between a loaded object and my camera. I''ve loaded a simple X file based mesh and given it some movement and now I''d like to implement some form of collision detection so that when my camera gets too close to the mesh a collision is detected. I''m working in VC6 and DX8.1, any ideas?

Share this post


Link to post
Share on other sites
D3DXIntersect (or something like that) lets you check if a given ray intersects a mesh, and if does, returns you the intersection coordinates and other relevant stuff.
Among the other stuff is the distance of the intersection; use that to your advantage

-Nik

Share this post


Link to post
Share on other sites
quote:
Original post by Nik02
D3DXIntersect (or something like that) lets you check if a given ray intersects a mesh, and if does, returns you the intersection coordinates and other relevant stuff.
Among the other stuff is the distance of the intersection; use that to your advantage


nice...I overlooked the fact that it returned where it intersected and it's distance. I'll be using that, thanks a lot. D3DXIntersect() does use barycentric and not cartesian coordinates, though.


Circlesoft Velocity Engine

[edited by - circlesoft on November 10, 2003 11:01:24 AM]

Share this post


Link to post
Share on other sites
quote:
Original post by circlesoft
D3DXIntersect() does use barycentric and not cartesian coordinates, though.



But it''s easy enough to expand barycentric coords to world space, since you also have the triangle''s vertex positions available.
Just lerp the positions with triangle''s u and v.

-Nik

Share this post


Link to post
Share on other sites