internal static Contact create( Fixture fixtureA, int indexA, Fixture fixtureB, int indexB )
{
var type1 = fixtureA.shape.shapeType;
var type2 = fixtureB.shape.shapeType;
Debug.Assert( ShapeType.Unknown < type1 && type1 < ShapeType.TypeCount );
Debug.Assert( ShapeType.Unknown < type2 && type2 < ShapeType.TypeCount );
Contact c;
var pool = fixtureA.body._world._contactPool;
if( pool.Count > 0 )
{
c = pool.Dequeue();
if( ( type1 >= type2 || ( type1 == ShapeType.Edge && type2 == ShapeType.Polygon ) ) && !( type2 == ShapeType.Edge && type1 == ShapeType.Polygon ) )
c.reset( fixtureA, indexA, fixtureB, indexB );
else
c.reset( fixtureB, indexB, fixtureA, indexA );
}
else
{
// Edge+Polygon is non-symetrical due to the way Erin handles collision type registration.
if( ( type1 >= type2 || ( type1 == ShapeType.Edge && type2 == ShapeType.Polygon ) ) && !( type2 == ShapeType.Edge && type1 == ShapeType.Polygon ) )
c = new Contact( fixtureA, indexA, fixtureB, indexB );
else
c = new Contact( fixtureB, indexB, fixtureA, indexA );
}
c._type = _contactRegisters[(int)type1, (int)type2];
return c;
}