diff options
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 04ea289..c16b7d3 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1028,6 +1028,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1028 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); | 1028 | Vector3 currentVelV = VehicleVelocity * Quaternion.Inverse(VehicleOrientation); |
1029 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); | 1029 | Vector3 linearMotorCorrectionV = m_linearMotor.Step(pTimestep, currentVelV); |
1030 | 1030 | ||
1031 | // Friction reduces vehicle motion | ||
1032 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep); | ||
1033 | linearMotorCorrectionV -= (currentVelV * frictionFactorW); | ||
1034 | |||
1031 | // Motor is vehicle coordinates. Rotate it to world coordinates | 1035 | // Motor is vehicle coordinates. Rotate it to world coordinates |
1032 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; | 1036 | Vector3 linearMotorVelocityW = linearMotorCorrectionV * VehicleOrientation; |
1033 | 1037 | ||
@@ -1041,9 +1045,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1041 | // Add this correction to the velocity to make it faster/slower. | 1045 | // Add this correction to the velocity to make it faster/slower. |
1042 | VehicleVelocity += linearMotorVelocityW; | 1046 | VehicleVelocity += linearMotorVelocityW; |
1043 | 1047 | ||
1044 | // Friction reduces vehicle motion | 1048 | |
1045 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep) * VehicleOrientation; | ||
1046 | VehicleVelocity -= (VehicleVelocity * frictionFactorW); | ||
1047 | 1049 | ||
1048 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", | 1050 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", |
1049 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, | 1051 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, |
@@ -1337,11 +1339,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1337 | // angularMotorContributionV.Y = 0f; | 1339 | // angularMotorContributionV.Y = 0f; |
1338 | // } | 1340 | // } |
1339 | 1341 | ||
1342 | // Reduce any velocity by friction. | ||
1343 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); | ||
1344 | angularMotorContributionV -= (currentAngularV * frictionFactorW); | ||
1345 | |||
1340 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; | 1346 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; |
1341 | 1347 | ||
1342 | // Reduce any velocity by friction. | 1348 | |
1343 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep) * VehicleOrientation; | ||
1344 | VehicleRotationalVelocity -= (VehicleRotationalVelocity * frictionFactorW); | ||
1345 | 1349 | ||
1346 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); | 1350 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); |
1347 | } | 1351 | } |