public void SetMotionState(IMotionState motionState) { m_optionalMotionState = motionState; if (m_optionalMotionState != null) { motionState.GetWorldTransform(out m_worldTransform); } }
///setupRigidBody is only used internally by the constructor protected void SetupRigidBody(RigidBodyConstructionInfo constructionInfo) { m_internalType = CollisionObjectTypes.CO_RIGID_BODY; m_linearVelocity = IndexedVector3.Zero; m_angularVelocity = IndexedVector3.Zero; m_angularFactor = IndexedVector3.One; m_linearFactor = IndexedVector3.One; m_gravity = IndexedVector3.Zero; m_gravity_acceleration = IndexedVector3.Zero; m_totalForce = IndexedVector3.Zero; m_totalTorque = IndexedVector3.Zero; SetDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping); m_linearSleepingThreshold = constructionInfo.m_linearSleepingThreshold; m_angularSleepingThreshold = constructionInfo.m_angularSleepingThreshold; m_optionalMotionState = constructionInfo.m_motionState; m_contactSolverType = 0; m_frictionSolverType = 0; m_additionalDamping = constructionInfo.m_additionalDamping; m_additionalDampingFactor = constructionInfo.m_additionalDampingFactor; m_additionalLinearDampingThresholdSqr = constructionInfo.m_additionalLinearDampingThresholdSqr; m_additionalAngularDampingThresholdSqr = constructionInfo.m_additionalAngularDampingThresholdSqr; m_additionalAngularDampingFactor = constructionInfo.m_additionalAngularDampingFactor; if (m_optionalMotionState != null) { m_optionalMotionState.GetWorldTransform(out m_worldTransform); } else { SetWorldTransform(ref constructionInfo.m_startWorldTransform); } m_interpolationWorldTransform = m_worldTransform; m_interpolationLinearVelocity = IndexedVector3.Zero; m_interpolationAngularVelocity = IndexedVector3.Zero; //moved to btCollisionObject m_friction = constructionInfo.m_friction; m_restitution = constructionInfo.m_restitution; SetCollisionShape(constructionInfo.m_collisionShape); m_debugBodyId = uniqueId++; SetMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia); UpdateInertiaTensor(); m_rigidbodyFlags = RigidBodyFlags.BT_NONE; m_constraintRefs = new List <TypedConstraint>(); m_deltaLinearVelocity = IndexedVector3.Zero; m_deltaAngularVelocity = IndexedVector3.Zero; m_invMass = m_inverseMass * m_linearFactor; m_pushVelocity = IndexedVector3.Zero; m_turnVelocity = IndexedVector3.Zero; }
public void SetMotionState(IMotionState motionState) { m_optionalMotionState = motionState; if (m_optionalMotionState != null) { motionState.GetWorldTransform(out m_worldTransform); } }
///setupRigidBody is only used internally by the constructor protected void SetupRigidBody(RigidBodyConstructionInfo constructionInfo) { m_internalType=CollisionObjectTypes.CO_RIGID_BODY; m_linearVelocity = IndexedVector3.Zero; m_angularVelocity = IndexedVector3.Zero; m_angularFactor = IndexedVector3.One; m_linearFactor = IndexedVector3.One; m_gravity = IndexedVector3.Zero; m_gravity_acceleration = IndexedVector3.Zero; m_totalForce = IndexedVector3.Zero; m_totalTorque = IndexedVector3.Zero; SetDamping(constructionInfo.m_linearDamping, constructionInfo.m_angularDamping); m_linearSleepingThreshold = constructionInfo.m_linearSleepingThreshold; m_angularSleepingThreshold = constructionInfo.m_angularSleepingThreshold; m_optionalMotionState = constructionInfo.m_motionState; m_contactSolverType = 0; m_frictionSolverType = 0; m_additionalDamping = constructionInfo.m_additionalDamping; m_additionalDampingFactor = constructionInfo.m_additionalDampingFactor; m_additionalLinearDampingThresholdSqr = constructionInfo.m_additionalLinearDampingThresholdSqr; m_additionalAngularDampingThresholdSqr = constructionInfo.m_additionalAngularDampingThresholdSqr; m_additionalAngularDampingFactor = constructionInfo.m_additionalAngularDampingFactor; if (m_optionalMotionState != null) { m_optionalMotionState.GetWorldTransform(out m_worldTransform); } else { SetWorldTransform(ref constructionInfo.m_startWorldTransform); } m_interpolationWorldTransform = m_worldTransform; m_interpolationLinearVelocity = IndexedVector3.Zero; m_interpolationAngularVelocity = IndexedVector3.Zero; //moved to btCollisionObject m_friction = constructionInfo.m_friction; m_restitution = constructionInfo.m_restitution; SetCollisionShape( constructionInfo.m_collisionShape ); m_debugBodyId = uniqueId++; SetMassProps(constructionInfo.m_mass, constructionInfo.m_localInertia); UpdateInertiaTensor(); m_rigidbodyFlags = RigidBodyFlags.BT_NONE; m_constraintRefs = new List<TypedConstraint>(); m_deltaLinearVelocity = IndexedVector3.Zero; m_deltaAngularVelocity = IndexedVector3.Zero; m_invMass = m_inverseMass * m_linearFactor; m_pushVelocity = IndexedVector3.Zero; m_turnVelocity = IndexedVector3.Zero; }