advice about a specific collision.

Started by
2 comments, last by BlueChip 20 years, 9 months ago
Hi folk... when I''ve need of a perfect collision between a bounding box and a triangle, I use 8 times a ray/plane collision. This way is too much slow.... can you give me a better idea? thanks ;-)
Advertisement
Use the velocity of the triangle as the ray. Then dot product this ray against the normals of each face of the box. if the result is <= 0, then the face is either facing away or parallel to the ray, and thus can''t be in collision. this should limit u to at most testing 1 ray versus 3 faces.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
ok.... thank you MelvinElvin.
but in this way I would have to apply the velocity in all three vertices of triangle.... doing 3*3 = 9 checks... and however the test could not be right , because the box could to be in the center of the triangle.

Am I in mistake?

[edited by - BlueChip on August 8, 2003 11:28:59 AM]
just give your triangle 1 velocity, not each vertex of the triangle. Yes, the test does not work if objects start off inside each other. This is the most common way of doing collision detection though. The fact it fails if something is inside another thing is just something u have to live with and work around, unless you use another technique for colliding of course.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!

This topic is closed to new replies.

Advertisement