aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorVegaslon2013-05-06 21:10:02 -0400
committerRobert Adams2013-05-07 07:14:06 -0700
commitf247ae1a7511f6bd5f31366bc301089434e73e3f (patch)
treefe6440234b2bc0cb61f9ec614e287ab403d891b2
parentBulletSim: normalize quaternian rotations when building compound linksets. (diff)
downloadopensim-SC_OLD-f247ae1a7511f6bd5f31366bc301089434e73e3f.zip
opensim-SC_OLD-f247ae1a7511f6bd5f31366bc301089434e73e3f.tar.gz
opensim-SC_OLD-f247ae1a7511f6bd5f31366bc301089434e73e3f.tar.bz2
opensim-SC_OLD-f247ae1a7511f6bd5f31366bc301089434e73e3f.tar.xz
BulletSim: Another way to create vehicle framed friction.
Signed-off-by: Robert Adams <Robert.Adams@intel.com>
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs8
1 files changed, 5 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index 04ea289..e93dbd7 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,