From 6a5d08819725a836a4072dec3bd3f84a1bd39ffb Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 24 Jan 2013 16:26:04 -0800 Subject: BulletSim: reduce the force of gravity on ground vehicles when they are on the ground. Makes them a little more stable. --- OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs') 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 get { return (Type != Vehicle.TYPE_NONE && Prim.IsPhysicallyActive); } } + // Return 'true' if this a vehicle that should be sitting on the ground + public bool IsGroundVehicle + { + get { return (Type == Vehicle.TYPE_CAR || Type == Vehicle.TYPE_SLED); } + } + #region Vehicle parameter setting internal void ProcessFloatVehicleParam(Vehicle pParam, float pValue) { @@ -1176,6 +1182,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin private void ApplyGravity(float pTimeStep) { Vector3 appliedGravity = m_VehicleGravity * m_vehicleMass; + + // Hack to reduce downward force if the vehicle is probably sitting on the ground + if (Prim.IsColliding && IsGroundVehicle) + appliedGravity *= 0.2f; + VehicleAddForce(appliedGravity); VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},appliedForce-{2}", -- cgit v1.1