From 905d7c43ad34869df03b21fcd24eb8ea8c6beeae Mon Sep 17 00:00:00 2001
From: Robert Adams
Date: Tue, 11 Dec 2012 00:35:16 -0800
Subject: BulletSim: modify LIMIT_MOTOR_UP to limit BOAT types to be at water
 rather than ground level. This makes boats float at water level better but
 not perfectly. There probably needs to be some interaction between HOVER and
 LIMIT_MOTOR_UP.

---
 OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
index acddc09..82e829e 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs
@@ -993,8 +993,8 @@ namespace OpenSim.Region.Physics.BulletSPlugin
 
             if ((m_flags & (VehicleFlag.LIMIT_MOTOR_UP)) != 0)
             {
-                // If the vehicle is motoring into the sky, get it going back down.
-                float distanceAboveGround = VehiclePosition.Z - GetTerrainHeight(VehiclePosition);
+                float targetHeight = Type == Vehicle.TYPE_BOAT ? GetWaterLevel(VehiclePosition) : GetTerrainHeight(VehiclePosition);
+                float distanceAboveGround = VehiclePosition.Z - targetHeight;
                 // Not colliding if the vehicle is off the ground
                 if (!Prim.IsColliding)
                 {
-- 
cgit v1.1