Advanced collision detection
I''m working on a 2d simulation of rigid body dynamics. This means a bunch of polygons that are supposed to bounce against each other and requires polygon-polygon collision detection. I want to simulate torque to get accurate spinning effects.
Anyway, the algorithm i use for collision detection is described on the top of this page: http://www.gamasutra.com/features/20000210/lander_02.htm ("Don''t cross that line" paragraph).
The problem is that this algorith only tells you if you are inside or outside the polygon. Since i want accurate physics i need to know what edge/vertex (the two possible types of collisions are vertex-edge and vertex-vertex) a certain corner of a certain poly collided with.
Therefore i need to know the points at which the attacking corner penetrates the the polygon. I do this by modifying the above algo to report not only if a point is inside or outside a poly but also if it is on an edge or on a corner. I use a tolerance value so that the point doesn''t have to be _exactly_ on the corner/edge.
Anyway, the problem is that this doesn''t work very well. Collisions are often not detected. Now that you know what requirements i have on my collision detection algo, does anyone have any tips of another algo i can use?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement