/// <summary> /// Removes element to the rigid body, you have to specify if you want to compute the inertia tensor, yes in case you will not remove another one or change mass /// </summary> public void RemoveElement(MyRBElement element, bool recomputeInertia) { MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); for (int i = 0; i < m_RBElementList.Count; i++) { if (m_RBElementList[i] == element) { element.SetRigidBody(null); physobj.RemoveRBElement(element); m_RBElementList.RemoveAt(i); break; } } if ((m_Flags & RigidBodyFlag.RBF_INSERTED) > 0) { MyPhysics.physicsSystem.GetRigidBodyModule().GetBroadphase().DestroyVolume(element); } if (recomputeInertia && m_RBElementList.Count > 0) { MyPhysicsUtils.ComputeIntertiaTensor(this); } }
public void RemoveAllElements() { MyPhysicsObjects physobj = MyPhysics.physicsSystem.GetPhysicsObjects(); for (int i = m_RBElementList.Count - 1; i >= 0; i--) { if ((m_Flags & RigidBodyFlag.RBF_INSERTED) > 0) { MyPhysics.physicsSystem.GetRigidBodyModule().GetBroadphase().DestroyVolume(m_RBElementList[i]); } m_RBElementList[i].SetRigidBody(null); physobj.RemoveRBElement(m_RBElementList[i]); m_RBElementList.RemoveAt(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); }