Vertical collisions and contact normals

Jan 7, 2010 at 3:33 AM

To detect vertical collisions, I'm looking at the normal's Y value. When object A is sitting on top of object B, the Y value of the contact normals passed to A's collision handler sometimes are positive and sometimes are negative. This is not related to the order the Geoms are passed to the handler, as A is always passed first. But, it does seem to be related to the order Geoms are added to the simulation - The normal will always be 'relative', that is, pointing away from, the Geom that was added first.

Right now I am working around the problem by comparing Geom1Index and Geom2Index in Contact.ContactID, and flipping the normal if Geom1Index < Geom2Index. But shouldn't the contact normals always be relative the Geom who's collision handler is being called?

Jan 7, 2010 at 3:42 AM

I take part of that back. A isn't always the first Geom passed to the handler. So my workaround doesn't work.

Coordinator
Jan 7, 2010 at 1:18 PM

The normals are relative to the creation order of the geometries. One way "around" it is to do as you have done; checking the index or simply using the less than or larger than operations on the geometries like this:

if (geomA > geomB) ....