aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index eb695d9..c34c05a 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -856,6 +856,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin
856 // The movement computed in the linear motor is relative to the vehicle 856 // The movement computed in the linear motor is relative to the vehicle
857 // coordinates. Rotate the movement to world coordinates. 857 // coordinates. Rotate the movement to world coordinates.
858 linearMotorContribution *= VehicleOrientation; 858 linearMotorContribution *= VehicleOrientation;
859 // All the contributions after this are world relative (mostly Z modifications)
859 860
860 // ================================================================== 861 // ==================================================================
861 // Buoyancy: force to overcome gravity. 862 // Buoyancy: force to overcome gravity.
@@ -982,14 +983,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
982 float verticalCorrectionVelocity = verticalError / m_VhoverTimescale; 983 float verticalCorrectionVelocity = verticalError / m_VhoverTimescale;
983 984
984 // TODO: implement m_VhoverEfficiency correctly 985 // TODO: implement m_VhoverEfficiency correctly
985 if (Math.Abs(verticalError) > m_VhoverEfficiency) 986 ret = new Vector3(0f, 0f, verticalCorrectionVelocity);
986 {
987 ret = new Vector3(0f, 0f, verticalCorrectionVelocity);
988 }
989 } 987 }
990 988
991 VDetailLog("{0}, MoveLinear,hover,pos={1},ret={2},hoverTS={3},height={4},target={5}", 989 VDetailLog("{0}, MoveLinear,hover,pos={1},eff={2},hoverTS={3},height={4},target={5},ret={6}",
992 Prim.LocalID, VehiclePosition, ret, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight); 990 Prim.LocalID, VehiclePosition, m_VhoverEfficiency, m_VhoverTimescale, m_VhoverHeight, m_VhoverTargetHeight, ret);
993 } 991 }
994 992
995 return ret; 993 return ret;
@@ -1238,6 +1236,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1238 Vector3 movingDirection = VehicleVelocity; 1236 Vector3 movingDirection = VehicleVelocity;
1239 movingDirection.Normalize(); 1237 movingDirection.Normalize();
1240 1238
1239 // If the vehicle is going backward, it is still pointing forward
1240 movingDirection *= Math.Sign(VehicleForwardSpeed);
1241
1241 // The direction the vehicle is pointing 1242 // The direction the vehicle is pointing
1242 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation; 1243 Vector3 pointingDirection = Vector3.UnitX * VehicleOrientation;
1243 pointingDirection.Normalize(); 1244 pointingDirection.Normalize();
@@ -1246,6 +1247,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1246 Vector3 deflectionError = movingDirection - pointingDirection; 1247 Vector3 deflectionError = movingDirection - pointingDirection;
1247 1248
1248 // Don't try to correct very large errors (not our job) 1249 // Don't try to correct very large errors (not our job)
1250 // if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = PIOverTwo * Math.Sign(deflectionError.X);
1251 // if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = PIOverTwo * Math.Sign(deflectionError.Y);
1252 // if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = PIOverTwo * Math.Sign(deflectionError.Z);
1249 if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = 0f; 1253 if (Math.Abs(deflectionError.X) > PIOverFour) deflectionError.X = 0f;
1250 if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = 0f; 1254 if (Math.Abs(deflectionError.Y) > PIOverFour) deflectionError.Y = 0f;
1251 if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = 0f; 1255 if (Math.Abs(deflectionError.Z) > PIOverFour) deflectionError.Z = 0f;