internal static b2Contact Create(b2Fixture fixtureA, int indexA, b2Fixture fixtureB, int indexB) { if (s_initialized == false) { InitializeRegisters(); s_initialized = true; } b2Shape.Type type1 = fixtureA.GetType(); b2Shape.Type type2 = fixtureB.GetType(); Debug.Assert(0 <= ((int)type1) && type1 < b2Shape.Type.e_typeCount); Debug.Assert(0 <= ((int)type2) && type2 < b2Shape.Type.e_typeCount); b2ContactCreateFcn createFcn = s_registers[(int)type1, (int)type2].createFcn; if (createFcn != null) { if (s_registers[(int)type1, (int)type2].primary) { return(createFcn(fixtureA, indexA, fixtureB, indexB)); } else { return(createFcn(fixtureB, indexB, fixtureA, indexA)); } } else { return(null); } }
internal static void Destroy(ref b2Contact contact) { Debug.Assert(s_initialized == true); b2Fixture fixtureA = contact.m_fixtureA; b2Fixture fixtureB = contact.m_fixtureB; if (contact.m_manifold.pointCount > 0 && fixtureA.IsSensor() == false && fixtureB.IsSensor() == false) { fixtureA.GetBody().SetAwake(true); fixtureB.GetBody().SetAwake(true); } b2Shape.Type typeA = fixtureA.GetType(); b2Shape.Type typeB = fixtureB.GetType(); Debug.Assert(0 <= ((int)typeA) && typeB < b2Shape.Type.e_typeCount); Debug.Assert(0 <= ((int)typeA) && typeB < b2Shape.Type.e_typeCount); b2ContactDestroyFcn destroyFcn = s_registers[(int)typeA, (int)typeB].destroyFcn; destroyFcn(ref contact); }
public b2Shape.Type GetType() { b2Shape.Type ret = (b2Shape.Type)Box2DPINVOKE.b2Fixture_GetType(swigCPtr); return(ret); }
static extern void b2Shape_SetType(IntPtr pointer, b2Shape.Type value);
protected static void AddType(b2ContactCreateFcn createFcn, b2ContactDestroyFcn destoryFcn, b2Shape.Type type1, b2Shape.Type type2) { Debug.Assert(0 <= ((int)type1) && type1 < b2Shape.Type.e_typeCount); Debug.Assert(0 <= ((int)type2) && type2 < b2Shape.Type.e_typeCount); s_registers[(int)type1, (int)type2] = new b2ContactRegister(); s_registers[(int)type1, (int)type2].createFcn = createFcn; s_registers[(int)type1, (int)type2].destroyFcn = destoryFcn; s_registers[(int)type1, (int)type2].primary = true; if (type1 != type2) { s_registers[(int)type2, (int)type1] = new b2ContactRegister(); s_registers[(int)type2, (int)type1].createFcn = createFcn; s_registers[(int)type2, (int)type1].destroyFcn = destoryFcn; s_registers[(int)type2, (int)type1].primary = false; } }
public b2Shape.Type GetShapeType() { b2Shape.Type ret = (b2Shape.Type)Box2dPINVOKE.b2Shape_GetShapeType(swigCPtr); return(ret); }