diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index aa247dd..c27d3f0 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs | |||
@@ -774,7 +774,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
774 | 774 | ||
775 | // Since the computation of terrain height can be a little involved, this routine | 775 | // Since the computation of terrain height can be a little involved, this routine |
776 | // is used to fetch the height only once for each vehicle simulation step. | 776 | // is used to fetch the height only once for each vehicle simulation step. |
777 | Vector3 lastRememberedHeightPos; | 777 | Vector3 lastRememberedHeightPos = new Vector3(-1, -1, -1); |
778 | private float GetTerrainHeight(Vector3 pos) | 778 | private float GetTerrainHeight(Vector3 pos) |
779 | { | 779 | { |
780 | if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos) | 780 | if ((m_knownHas & m_knownChangedTerrainHeight) == 0 || pos != lastRememberedHeightPos) |
@@ -788,14 +788,16 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
788 | 788 | ||
789 | // Since the computation of water level can be a little involved, this routine | 789 | // Since the computation of water level can be a little involved, this routine |
790 | // is used ot fetch the level only once for each vehicle simulation step. | 790 | // is used ot fetch the level only once for each vehicle simulation step. |
791 | Vector3 lastRememberedWaterHeightPos = new Vector3(-1, -1, -1); | ||
791 | private float GetWaterLevel(Vector3 pos) | 792 | private float GetWaterLevel(Vector3 pos) |
792 | { | 793 | { |
793 | if ((m_knownHas & m_knownChangedWaterLevel) == 0) | 794 | if ((m_knownHas & m_knownChangedWaterLevel) == 0 || pos != lastRememberedWaterHeightPos) |
794 | { | 795 | { |
796 | lastRememberedWaterHeightPos = pos; | ||
795 | m_knownWaterLevel = ControllingPrim.PhysScene.TerrainManager.GetWaterLevelAtXYZ(pos); | 797 | m_knownWaterLevel = ControllingPrim.PhysScene.TerrainManager.GetWaterLevelAtXYZ(pos); |
796 | m_knownHas |= m_knownChangedWaterLevel; | 798 | m_knownHas |= m_knownChangedWaterLevel; |
797 | } | 799 | } |
798 | return (float)m_knownWaterLevel; | 800 | return m_knownWaterLevel; |
799 | } | 801 | } |
800 | 802 | ||
801 | private Vector3 VehiclePosition | 803 | private Vector3 VehiclePosition |
@@ -991,11 +993,17 @@ namespace OpenSim.Region.Physics.BulletSPlugin | |||
991 | { | 993 | { |
992 | Vector3 vel = VehicleVelocity; | 994 | Vector3 vel = VehicleVelocity; |
993 | if ((m_flags & (VehicleFlag.NO_X)) != 0) | 995 | if ((m_flags & (VehicleFlag.NO_X)) != 0) |
996 | { | ||
994 | vel.X = 0; | 997 | vel.X = 0; |
998 | } | ||
995 | if ((m_flags & (VehicleFlag.NO_Y)) != 0) | 999 | if ((m_flags & (VehicleFlag.NO_Y)) != 0) |
1000 | { | ||
996 | vel.Y = 0; | 1001 | vel.Y = 0; |
1002 | } | ||
997 | if ((m_flags & (VehicleFlag.NO_Z)) != 0) | 1003 | if ((m_flags & (VehicleFlag.NO_Z)) != 0) |
1004 | { | ||
998 | vel.Z = 0; | 1005 | vel.Z = 0; |
1006 | } | ||
999 | VehicleVelocity = vel; | 1007 | VehicleVelocity = vel; |
1000 | } | 1008 | } |
1001 | 1009 | ||