[ODE] multiple collision points

Mario Riva mriv00 at hotmail.com
Sun Jan 13 03:11:02 2002


Newsgroup: 
comp.games.development.programming.algorithms,comp.graphics.algorithms


Hilaire VERSCHUERE wrote:

>OK I better explain my problem.

>I'm using SOLID to detect collisions between Rigid Bodies, but SOLID give 
>me
>only one collision point betwen two mesh. If my rigid body is a box falling
>on a plan, at the collision, I've got to act on the four vertex of the box
>in contact with the plan. SOLID give me only the first collision point he
>met, usually one of the four vertex and it is not sufficient to put 
>reaction
>on the box.
>I could use an other collision detection library but SOLID has the 
>advantage
>to give me the normal of collision and a real collision point between Rigid
>Body and not the faces concerned by the collision as other library do.


John Nagle (Animats)has replied:

       What SOLID is giving you are the two closest points involved
in the collision.  What you want is the "contact polygon".
For two nearby, non-intersecting convex polyhedra, here's
the algorithm.


    1. First, get from GJK (inside SOLID) the final simplex from
the GJK algorithm.  This defines the closest set of features
for the two nearby bodies.  Each body will have one, two,
or three points in the simplex.  A body with one point
indicates the closest point is a vertex.  A body with three
points indicates the closest point is in the interior of
a face.  A body with two points indicates either that the
contact is along an edge or on a diagonal of a face.

    2. With this data extracted, for each face, find the
"most parallel face" for each object.  This is the
face most perpendicular to the line through the
closest points reported by GJK.  If the GJK simplex
defined a face, that's the face.  If it defined a
vertex, pick the most parallel face of those meeting
at that vertex.  If the simplex defined an edge, pick
the most parallel face that includes that edge.  The
output of this step is two faces, one on each body.

    3. Project both faces from the previous step onto the
plane which goes through the midpoint of the line segment
between the closest points, and is perpendicular to
that line.  This yields two convex polygons in a plane.

    4. Compute the intersection of those two convex polygons.
This is the contact polygon.

This is all straightforward geometry and bookkeeping.  Check
those GJK simplicies, though; if you get a simplex that has
points from more than one face, you've found a problem
with GJK (roundoff errors can occur) or the original geometry
wasn't convex.  The input geometry should not have coplanar
faces.  So don't tesselate your convex hulls.  When you
have a cube on a bigger cube, you want a square contact
polygon, not a triangle.






_________________________________________________________________
MSN Photos č il metodo pių semplice per condividere e stampare le tue foto: 
http://photos.msn.it/Support/WorldWide.aspx