BulletSim: implement the SL bug where VEHICLE_HOVER_UP_ONLY disables

the vehicle buoyancy if the vehicle is above its hover height.

This is a known misfeature of this vehicle flag which has been accepted
since it would break too many implementations. The problem is noticed
when creating a jetski-like vehicle that jumps over sand bars. A boat
normally is configured with neutral buoyancy and hovering at water
height. When it jumps the sandbar, it needs to have gravity applied
to get back to water level.
varregion
Robert Adams 2013-10-15 17:02:22 -07:00
parent d0c1780839
commit 766a31431e
1 changed files with 12 additions and 0 deletions

View File

@ -1125,7 +1125,19 @@ namespace OpenSim.Region.Physics.BulletSPlugin
{
// If body is already heigher, use its height as target height
if (VehiclePosition.Z > m_VhoverTargetHeight)
{
m_VhoverTargetHeight = VehiclePosition.Z;
// A 'misfeature' of this flag is that if the vehicle is above it's hover height,
// the vehicle's buoyancy goes away. This is an SL bug that got used by so many
// scripts that it could not be changed.
// So, if above the height, reapply gravity if buoyancy had it turned off.
if (m_VehicleBuoyancy != 0)
{
Vector3 appliedGravity = ControllingPrim.ComputeGravity(ControllingPrim.Buoyancy) * m_vehicleMass;
VehicleAddForce(appliedGravity);
}
}
}
if ((m_flags & VehicleFlag.LOCK_HOVER_HEIGHT) != 0)