aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorRobert Adams2013-01-24 16:26:04 -0800
committerRobert Adams2013-01-24 16:26:04 -0800
commit6a5d08819725a836a4072dec3bd3f84a1bd39ffb (patch)
tree2ababc5a7d7b57e4cb51bc06414e979abddc62b8 /OpenSim/Region
parentBulletSim: reduce the zeroing threshold for rotational velocity. (diff)
downloadopensim-SC_OLD-6a5d08819725a836a4072dec3bd3f84a1bd39ffb.zip
opensim-SC_OLD-6a5d08819725a836a4072dec3bd3f84a1bd39ffb.tar.gz
opensim-SC_OLD-6a5d08819725a836a4072dec3bd3f84a1bd39ffb.tar.bz2
opensim-SC_OLD-6a5d08819725a836a4072dec3bd3f84a1bd39ffb.tar.xz
BulletSim: reduce the force of gravity on ground vehicles when they
are on the ground. Makes them a little more stable.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs11
1 files changed, 11 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index f1ef449..7ad7c89 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -158,6 +158,12 @@ namespace OpenSim.Region.Physics.BulletSPlugin
158 get { return (Type != Vehicle.TYPE_NONE && Prim.IsPhysicallyActive); } 158 get { return (Type != Vehicle.TYPE_NONE && Prim.IsPhysicallyActive); }
159 } 159 }
160 160
161 // Return 'true' if this a vehicle that should be sitting on the ground
162 public bool IsGroundVehicle
163 {
164 get { return (Type == Vehicle.TYPE_CAR || Type == Vehicle.TYPE_SLED); }
165 }
166
161 #region Vehicle parameter setting 167 #region Vehicle parameter setting
162 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) 168 internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue)
163 { 169 {
@@ -1176,6 +1182,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
1176 private void ApplyGravity(float pTimeStep) 1182 private void ApplyGravity(float pTimeStep)
1177 { 1183 {
1178 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass; 1184 Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass;
1185
1186 // Hack to reduce downward force if the vehicle is probably sitting on the ground
1187 if (Prim.IsColliding && IsGroundVehicle)
1188 appliedGravity *= 0.2f;
1189
1179 VehicleAddForce(appliedGravity); 1190 VehicleAddForce(appliedGravity);
1180 1191
1181 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},appliedForce-{2}", 1192 VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},appliedForce-{2}",