public static Contact Create(Shape shape1, Shape shape2) { if (!Contact.s_initialized) { Contact.InitializeRegisters(); Contact.s_initialized = true; } ShapeType type = shape1.GetType(); ShapeType type2 = shape2.GetType(); Box2DXDebug.Assert(ShapeType.UnknownShape < type && type < ShapeType.ShapeTypeCount); Box2DXDebug.Assert(ShapeType.UnknownShape < type2 && type2 < ShapeType.ShapeTypeCount); ContactCreateFcn createFcn = Contact.s_registers[(int)type][(int)type2].CreateFcn; Contact result; if (createFcn != null) { if (Contact.s_registers[(int)type][(int)type2].Primary) { result = createFcn(shape1, shape2); } else { Contact contact = createFcn(shape2, shape1); for (int i = 0; i < contact.GetManifoldCount(); i++) { Manifold manifold = contact.GetManifolds()[i]; manifold.Normal = -manifold.Normal; } result = contact; } } else { result = null; } return(result); }