BulletSim: fix boats floating low by removing LIMIT_MOTOR_UP flag from TYPE_BOAT definition.

integration
Robert Adams 2012-11-28 09:46:05 -08:00
parent 24b3b4df2e
commit 2ccd4c1302
1 changed files with 15 additions and 3 deletions

View File

@ -445,9 +445,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin
m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY
| VehicleFlag.HOVER_GLOBAL_HEIGHT
| VehicleFlag.LIMIT_ROLL_ONLY
| VehicleFlag.LIMIT_MOTOR_UP
| VehicleFlag.HOVER_UP_ONLY);
m_flags |= (VehicleFlag.NO_DEFLECTION_UP
| VehicleFlag.LIMIT_MOTOR_UP
| VehicleFlag.HOVER_WATER_ONLY);
break;
case Vehicle.TYPE_AIRPLANE:
@ -805,6 +805,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin
return changed;
}
// From http://wiki.secondlife.com/wiki/LlSetVehicleFlags :
// Prevent ground vehicles from motoring into the sky.This flag has a subtle effect when
// used with conjunction with banking: the strength of the banking will decay when the
// vehicle no longer experiences collisions. The decay timescale is the same as
// VEHICLE_BANKING_TIMESCALE. This is to help prevent ground vehicles from steering
// when they are in mid jump.
// TODO: this code is wrong. Also, what should it do for boats?
public Vector3 ComputeLinearMotorUp(float pTimestep, Vector3 pos, float terrainHeight)
{
Vector3 ret = Vector3.Zero;
@ -818,10 +825,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
// downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale);
ret = new Vector3(0, 0, -distanceAboveGround);
}
// TODO: this calculation is all wrong. From the description at
// TODO: this calculation is wrong. From the description at
// (http://wiki.secondlife.com/wiki/Category:LSL_Vehicle), the downForce
// has a decay factor. This says this force should
// be computed with a motor.
// TODO: add interaction with banking.
VDetailLog("{0},MoveLinear,limitMotorUp,distAbove={1},downForce={2}",
Prim.LocalID, distanceAboveGround, ret);
}
@ -864,7 +872,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin
Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep);
// ==================================================================
// NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement
// From http://wiki.secondlife.com/wiki/LlSetVehicleFlags :
// This flag prevents linear deflection parallel to world z-axis. This is useful
// for preventing ground vehicles with large linear deflection, like bumper cars,
// from climbing their linear deflection into the sky.
// That is, NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement
if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0)
{
angularMotorContribution.X = 0f;