Detecting Intersection Without D3DXIntersect

Started by
2 comments, last by circlesoft 19 years, 7 months ago
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
Advertisement
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).

Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse

yeah i guess, i hadnt really thought of that,

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.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )

This topic is closed to new replies.

Advertisement