Detecting Intersection Without D3DXIntersect
Hi all,
Im writing a game in which i have a vertex buffer that contains vertices for 20 cubes. Each cube occupies 36 vertices as a triangle list.
How do i test to see if the vector for the pick ray intersects with this cube. I assume i'd have to test each triangle for intersection?
Where can i find the maths for this simple triangle/ray intersection.
any help is appreciated,
ace
Are you sure it wouldn't be easier to do this outside of the graphics system? I mean, you must have non-graphics data for your cubes somewhere, right? (Position, rotation, etc - the data you use to generate the vertices).
You should just be able to pull your ray back through the projection/view matrices to get it in world coordinates, and then you can collide it against your cubes directly, which ought to be easier (20 tests instead of 20*12 tests).
You should just be able to pull your ray back through the projection/view matrices to get it in world coordinates, and then you can collide it against your cubes directly, which ought to be easier (20 tests instead of 20*12 tests).
yeah i guess, i hadnt really thought of that,
Im still not entirely sure of how to do that though.
Im still not entirely sure of how to do that though.
Quote:Original post by ace_lovegrove
Where can i find the maths for this simple triangle/ray intersection
This is a great collision detection reference.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement