diff options
author | Robert Adams | 2013-05-06 16:48:01 -0700 |
---|---|---|
committer | Robert Adams | 2013-05-06 16:48:01 -0700 |
commit | 93e1986d690cda415c9cce639a2656bc773a9a29 (patch) | |
tree | c91c1513700714906a7bbb07b832bbbf67988d58 /OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |
parent | BulletSim: remove friction calcuation from BSMotor and move linear and (diff) | |
download | opensim-SC_OLD-93e1986d690cda415c9cce639a2656bc773a9a29.zip opensim-SC_OLD-93e1986d690cda415c9cce639a2656bc773a9a29.tar.gz opensim-SC_OLD-93e1986d690cda415c9cce639a2656bc773a9a29.tar.bz2 opensim-SC_OLD-93e1986d690cda415c9cce639a2656bc773a9a29.tar.xz |
BulletSim: apply linear and angular friction in vehicle coordinates
and not world coordinates.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 272a162..04ea289 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -1042,12 +1042,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1042 | VehicleVelocity += linearMotorVelocityW; | 1042 | VehicleVelocity += linearMotorVelocityW; |
1043 | 1043 | ||
1044 | // Friction reduces vehicle motion | 1044 | // Friction reduces vehicle motion |
1045 | Vector3 frictionFactor = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep); | 1045 | Vector3 frictionFactorW = ComputeFrictionFactor(m_linearFrictionTimescale, pTimestep) * VehicleOrientation; |
1046 | VehicleVelocity -= (VehicleVelocity * frictionFactor); | 1046 | VehicleVelocity -= (VehicleVelocity * frictionFactorW); |
1047 | 1047 | ||
1048 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", | 1048 | VDetailLog("{0}, MoveLinear,velocity,origVelW={1},velV={2},correctV={3},correctW={4},newVelW={5},fricFact={6}", |
1049 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, | 1049 | ControllingPrim.LocalID, origVelW, currentVelV, linearMotorCorrectionV, |
1050 | linearMotorVelocityW, VehicleVelocity, frictionFactor); | 1050 | linearMotorVelocityW, VehicleVelocity, frictionFactorW); |
1051 | } | 1051 | } |
1052 | 1052 | ||
1053 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) | 1053 | public void ComputeLinearTerrainHeightCorrection(float pTimestep) |
@@ -1340,10 +1340,10 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
1340 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; | 1340 | VehicleRotationalVelocity += angularMotorContributionV * VehicleOrientation; |
1341 | 1341 | ||
1342 | // Reduce any velocity by friction. | 1342 | // Reduce any velocity by friction. |
1343 | Vector3 frictionFactor = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep); | 1343 | Vector3 frictionFactorW = ComputeFrictionFactor(m_angularFrictionTimescale, pTimestep) * VehicleOrientation; |
1344 | VehicleRotationalVelocity -= (VehicleRotationalVelocity * frictionFactor); | 1344 | VehicleRotationalVelocity -= (VehicleRotationalVelocity * frictionFactorW); |
1345 | 1345 | ||
1346 | VDetailLog("{0}, MoveAngular,angularTurning,angularMotorContrib={1}", ControllingPrim.LocalID, angularMotorContributionV); | 1346 | VDetailLog("{0}, MoveAngular,angularTurning,angContribV={1}", ControllingPrim.LocalID, angularMotorContributionV); |
1347 | } | 1347 | } |
1348 | 1348 | ||
1349 | // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: | 1349 | // From http://wiki.secondlife.com/wiki/Linden_Vehicle_Tutorial: |