BulletSim: Another way to create vehicle framed friction.
Signed-off-by: Robert Adams <Robert.Adams@intel.com>user_profiles
parent
ddd97cb78e
commit
f247ae1a75
|
@ -1028,6 +1028,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation);
|
Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation);
|
||||||
Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV);
|
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
|
// Motor is vehicle coordinates. Rotate it to world coordinates
|
||||||
Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation;
|
Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation;
|
||||||
|
|
||||||
|
@ -1041,9 +1045,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
|
||||||
// Add this correction to the velocity to make it faster/slower.
|
// Add this correction to the velocity to make it faster/slower.
|
||||||
VehicleVelocity += linearMotorVelocityW;
|
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}",
|
VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}",
|
||||||
ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV,
|
ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV,
|
||||||
|
|
Loading…
Reference in New Issue