public static Contact Create(Fixture fixtureA, Fixture fixtureB)
{
if (s_initialized == false)
{
InitializeRegisters();
s_initialized = true;
}
ShapeType type1 = fixtureA.ShapeType;
ShapeType type2 = fixtureB.ShapeType;
Box2DXDebug.Assert(ShapeType.UnknownShape < type1 && type1 < ShapeType.ShapeTypeCount);
Box2DXDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount);
ContactCreateFcn createFcn = s_registers[(int)type1][(int)type2].CreateFcn;
if (createFcn != null)
{
if (s_registers[(int)type1][(int)type2].Primary)
{
return createFcn(fixtureA, fixtureB);
}
else
{
return createFcn(fixtureB, fixtureA);
}
}
else
{
return null;
}
}