BulletSim: Another way to create vehicle framed friction.

Signed-off-by: Robert Adams <Robert.Adams@intel.com>
user_profiles
Vegaslon 2013-05-06 21:10:02 -04:00 committed by Robert Adams
parent ddd97cb78e
commit f247ae1a75
1 changed files with 5 additions and 3 deletions

View File

@ -1028,6 +1028,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation);
Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV);
// Friction reduces vehicle motion
Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep);
linearMotorCorrectionV -= (currentVelV * frictionFactorW);
// Motor is vehicle coordinates. Rotate it to world coordinates
Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation;
@ -1041,9 +1045,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// Add this correction to the velocity to make it faster/slower.
VehicleVelocity += linearMotorVelocityW;
// Friction reduces vehicle motion
Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep) * VehicleOrientation;
VehicleVelocity -= (VehicleVelocity * frictionFactorW);
VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}",
ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV,