diff options
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index b6e3594..3a73fba 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -445,9 +445,9 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
445 | m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY | 445 | m_flags &= ~(VehicleFlag.HOVER_TERRAIN_ONLY |
446 | | VehicleFlag.HOVER_GLOBAL_HEIGHT | 446 | | VehicleFlag.HOVER_GLOBAL_HEIGHT |
447 | | VehicleFlag.LIMIT_ROLL_ONLY | 447 | | VehicleFlag.LIMIT_ROLL_ONLY |
448 | | VehicleFlag.LIMIT_MOTOR_UP | ||
448 | | VehicleFlag.HOVER_UP_ONLY); | 449 | | VehicleFlag.HOVER_UP_ONLY); |
449 | m_flags |= (VehicleFlag.NO_DEFLECTION_UP | 450 | m_flags |= (VehicleFlag.NO_DEFLECTION_UP |
450 | | VehicleFlag.LIMIT_MOTOR_UP | ||
451 | | VehicleFlag.HOVER_WATER_ONLY); | 451 | | VehicleFlag.HOVER_WATER_ONLY); |
452 | break; | 452 | break; |
453 | case Vehicle.TYPE_AIRPLANE: | 453 | case Vehicle.TYPE_AIRPLANE: |
@@ -805,6 +805,13 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
805 | return changed; | 805 | return changed; |
806 | } | 806 | } |
807 | 807 | ||
808 | // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags : | ||
809 | // Prevent ground vehicles from motoring into the sky.This flag has a subtle effect when | ||
810 | // used with conjunction with banking: the strength of the banking will decay when the | ||
811 | // vehicle no longer experiences collisions. The decay timescale is the same as | ||
812 | // VEHICLE_BANKING_TIMESCALE. This is to help prevent ground vehicles from steering | ||
813 | // when they are in mid jump. | ||
814 | // TODO: this code is wrong. Also, what should it do for boats? | ||
808 | public Vector3 ComputeLinearMotorUp(float pTimestep, Vector3 pos, float terrainHeight) | 815 | public Vector3 ComputeLinearMotorUp(float pTimestep, Vector3 pos, float terrainHeight) |
809 | { | 816 | { |
810 | Vector3 ret = Vector3.Zero; | 817 | Vector3 ret = Vector3.Zero; |
@@ -818,10 +825,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
818 | // downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale); | 825 | // downForce = new Vector3(0, 0, -distanceAboveGround / m_bankingTimescale); |
819 | ret = new Vector3(0, 0, -distanceAboveGround); | 826 | ret = new Vector3(0, 0, -distanceAboveGround); |
820 | } | 827 | } |
821 | // TODO: this calculation is all wrong. From the description at | 828 | // TODO: this calculation is wrong. From the description at |
822 | // (http://wiki.secondlife.com/wiki/Category:LSL_Vehicle), the downForce | 829 | // (http://wiki.secondlife.com/wiki/Category:LSL_Vehicle), the downForce |
823 | // has a decay factor. This says this force should | 830 | // has a decay factor. This says this force should |
824 | // be computed with a motor. | 831 | // be computed with a motor. |
832 | // TODO: add interaction with banking. | ||
825 | VDetailLog("{0},MoveLinear,limitMotorUp,distAbove={1},downForce={2}", | 833 | VDetailLog("{0},MoveLinear,limitMotorUp,distAbove={1},downForce={2}", |
826 | Prim.LocalID, distanceAboveGround, ret); | 834 | Prim.LocalID, distanceAboveGround, ret); |
827 | } | 835 | } |
@@ -864,7 +872,11 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
864 | Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep); | 872 | Vector3 angularMotorContribution = m_angularMotor.Step(pTimestep); |
865 | 873 | ||
866 | // ================================================================== | 874 | // ================================================================== |
867 | // NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement | 875 | // From http://wiki.secondlife.com/wiki/LlSetVehicleFlags : |
876 | // This flag prevents linear deflection parallel to world z-axis. This is useful | ||
877 | // for preventing ground vehicles with large linear deflection, like bumper cars, | ||
878 | // from climbing their linear deflection into the sky. | ||
879 | // That is, NO_DEFLECTION_UP says angular motion should not add any pitch or roll movement | ||
868 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) | 880 | if ((m_flags & (VehicleFlag.NO_DEFLECTION_UP)) != 0) |
869 | { | 881 | { |
870 | angularMotorContribution.X = 0f; | 882 | angularMotorContribution.X = 0f; |