/// <summary> /// Initializes the constraint and creates the guid for contact reporting /// </summary> public void Init(MyRBElementInteraction interaction, MySmallCollPointInfo[] pointInfos, int numPointInfos) { this.m_Interaction = interaction; m_Magnitude = 0.0f; numPointInfos = (numPointInfos > MaxCollisionPoints) ? MaxCollisionPoints : numPointInfos; m_NumCollPts = 0; MyContactConstraintModule mod = MyPhysics.physicsSystem.GetContactConstraintModule(); for (int i = 0; i < numPointInfos; ++i) { this.m_PointInfo[m_NumCollPts] = mod.PopCollPointInfo(); this.m_PointInfo[m_NumCollPts++].Init(ref pointInfos[i]); } uint guid1 = (uint)interaction.RBElement1.GUID; uint guid2 = (uint)interaction.RBElement2.GUID; if (guid1 > guid2) { uint tm = guid2; guid2 = guid1; guid1 = tm; } m_Guid = guid1 + (guid2 << 16); }
// public List<CollPointInfo> public void Destroy() { MyContactConstraintModule mod = MyPhysics.physicsSystem.GetContactConstraintModule(); for (int i = 0; i < m_NumCollPts; ++i) { mod.PushCollPointInfo(this.m_PointInfo[i]); } }
public MyPhysics() { physicsSystem = this; m_RigidBodyModule = new MyRigidBodyModule(); m_SensorModule = new MySensorModule(); m_ContactConstraintModule = new MyContactConstraintModule(); m_SensorInteractionModule = new MySensorInteractionModule(); m_RBInteractionModule = new MyRBInteractionModule(); m_Utils = new MyPhysicsUtils(); m_PhysicsObjects = new MyPhysicsObjects(); m_SimulationHandlers = new List <MyPhysSimulationHandler>(16); }
public MyPhysics() { physicsSystem = this; m_RigidBodyModule = new MyRigidBodyModule(); m_SensorModule = new MySensorModule(); m_ContactConstraintModule = new MyContactConstraintModule(); m_SensorInteractionModule = new MySensorInteractionModule(); m_RBInteractionModule = new MyRBInteractionModule(); m_Utils = new MyPhysicsUtils(); m_PhysicsObjects = new MyPhysicsObjects(); m_SimulationHandlers = new List<MyPhysSimulationHandler>(16); }