Archived

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

palver2

Help Needed on Collision Detection Algorithm

Recommended Posts

Hi everyone, I would like to request help on a collision detection algorithm that I have written. Its purpose is to detect collision between a bounding box and the surrounding walls, which are made of triangular polygons. I tested whether the 4 longest diagonals of the bounding box intersect the wall polygons. The algorithm worked fine in most cases, except in this particular instance: Whenever the box approaches 2 walls that meet perpendicularly at a corner that is jutting out, with the box moving such that it will move parallel to one wall, just touching the wall but not intersecting it, then the algorithm detects collision when the box first reaches the corner and then it doesn''t detect collision after the box has moved on from the corner. Try as I might, I haven''t been able to debug this problem. Could anyone help me with this problem? Thank you very much

Share this post


Link to post
Share on other sites
It sounds like your line-to-edge detection is picking up the collision, but your line-to-face detection is missing it - not uncommon.

It's pretty tricky to get both unit tests to agree - there will always be cases where floating point innacuracy causes discrepancies.

For the record, I'd highly recommend the seperating axis method for CD between a box and a triangle. Once you strip it down to the minimum it's very fast, has lots of early outs, and is well suited to temporal coherency optimisation.

Take a look at Magic Software and don't forget to read the Licence if you use the code.


[edited by - Osc on August 8, 2003 8:53:44 AM]

Share this post


Link to post
Share on other sites