/// <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); } }
/// <summary> /// Adds element to the rigid body, you have to specify if you want to compute the inertia tensor, yes in case you will not insert another one or change mass /// </summary> public bool AddElement(MyRBElement element, bool recomputeInertia) { m_RBElementList.Add(element); element.SetRigidBody(this); if ((m_Flags & RigidBodyFlag.RBF_INSERTED) > 0) { MyPhysics.physicsSystem.GetRigidBodyModule().GetBroadphase().CreateVolume(element); } if (recomputeInertia) { MyPhysicsUtils.ComputeIntertiaTensor(this); } return(true); }
/// <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); }
/// <summary> /// Adds element to the rigid body, you have to specify if you want to compute the inertia tensor, yes in case you will not insert another one or change mass /// </summary> public bool AddElement(MyRBElement element, bool recomputeInertia) { m_RBElementList.Add(element); element.SetRigidBody(this); if ((m_Flags & RigidBodyFlag.RBF_INSERTED) > 0) { MyPhysics.physicsSystem.GetRigidBodyModule().GetBroadphase().CreateVolume(element); } if (recomputeInertia) MyPhysicsUtils.ComputeIntertiaTensor(this); return true; }