Archived

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

BlueChip

advice about a specific collision.

Recommended Posts

BlueChip    100
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 ;-)

Share this post


Link to post
Share on other sites
MelvinElvin    122
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.

Share this post


Link to post
Share on other sites
BlueChip    100
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]

Share this post


Link to post
Share on other sites
MelvinElvin    122
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.

Share this post


Link to post
Share on other sites