//internal void DoAngularVelocityFix() //{ // if( nonSymmetricInertia ) // { // Vec3 velocity = AngularVelocity; // float currentAngVelMagSquared = velocity.LengthSqr(); // if( freelySpinning ) // { // // If the current angular velocity magnitude is greater than // // that of the previous step, scale it by that of the previous // // step; otherwise, update the previous value to that of the // // current step. This ensures that angular velocity never // // increases for freely-spinning objects. // if( currentAngVelMagSquared > prevAngVelMagSquared ) // { // float currentAngVelMag = MathFunctions.Sqrt16( currentAngVelMagSquared ); // velocity = velocity / currentAngVelMag; // // Vel is now a unit vector. Next, scale this vector // // by the previous angular velocity magnitude. // float prevAngVelMag = MathFunctions.Sqrt16( prevAngVelMagSquared ); // AngularVelocity = velocity * prevAngVelMag; // } // } // prevAngVelMagSquared = currentAngVelMagSquared; // } // // Reset the "freely-spinning" parameter for the next time step. // freelySpinning = true; // //fix MaxAngularVelocity // { // float max = ODEPhysicsWorld.Instance.MaxAngularVelocity; // Vec3 vel = AngularVelocity; // bool changed = false; // if( vel.X < -max ) { vel.X = -max; changed = true; } // else if( vel.X > max ) { vel.X = max; changed = true; } // if( vel.Y < -max ) { vel.Y = -max; changed = true; } // else if( vel.Y > max ) { vel.Y = max; changed = true; } // if( vel.Z < -max ) { vel.Z = -max; changed = true; } // else if( vel.Z > max ) { vel.Z = max; changed = true; } // if( changed ) // AngularVelocity = vel; // } //} public override void ClearForces() { base.ClearForces(); if (bodyID != dBodyID.Zero) { Ode.dBodySetForce(bodyID, 0, 0, 0); Ode.dBodySetTorque(bodyID, 0, 0, 0); } }