///apply gravity, call this once per timestep public virtual void ApplyGravity() { int length = m_nonStaticRigidBodies.Count; for (int i = 0; i < length; ++i) { RigidBody body = m_nonStaticRigidBodies[i]; if (body != null && body.IsActive()) { body.ApplyGravity(); } } }
protected void PredictUnconstraintMotion(float timeStep) { foreach (CollisionObject colObj in m_collisionObjects) { RigidBody body = RigidBody.Upcast(colObj); if (body != null) { if (!body.IsStaticObject()) { if (body.IsActive()) { body.ApplyGravity(); body.IntegrateVelocities(timeStep); body.ApplyDamping(timeStep); IndexedMatrix temp = body.GetInterpolationWorldTransform(); body.PredictIntegratedTransform(timeStep, out temp); body.SetInterpolationWorldTransform(ref temp); } } } } }