diff options
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 1b8a454..54bae21 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -139,6 +139,21 @@ public class BSActorAvatarMove : BSActor | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | private float ComputeMinFlightHeight() | ||
143 | { | ||
144 | float waterHeight = m_physicsScene.TerrainManager.GetWaterLevelAtXYZ(m_controllingPrim.RawPosition); | ||
145 | float groundHeight = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition); | ||
146 | |||
147 | if (groundHeight > waterHeight) | ||
148 | { | ||
149 | return groundHeight + 8f; | ||
150 | } | ||
151 | else | ||
152 | { | ||
153 | return waterHeight + 8f; | ||
154 | } | ||
155 | } | ||
156 | |||
142 | private void DeactivateAvatarMove() | 157 | private void DeactivateAvatarMove() |
143 | { | 158 | { |
144 | if (m_velocityMotor != null) | 159 | if (m_velocityMotor != null) |
@@ -265,6 +280,17 @@ public class BSActorAvatarMove : BSActor | |||
265 | // Add special movement force to allow avatars to walk up stepped surfaces. | 280 | // Add special movement force to allow avatars to walk up stepped surfaces. |
266 | moveForce += WalkUpStairs(); | 281 | moveForce += WalkUpStairs(); |
267 | 282 | ||
283 | //Alicia: Maintain minimum height when flying | ||
284 | if (m_controllingPrim.Flying) | ||
285 | { | ||
286 | float hover_height = ComputeMinFlightHeight(); | ||
287 | |||
288 | if( m_controllingPrim.Position.Z < hover_height) | ||
289 | { | ||
290 | moveForce.Z = moveForce.Z + 50f; | ||
291 | } | ||
292 | } | ||
293 | |||
268 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", | 294 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", |
269 | m_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce); | 295 | m_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce); |
270 | m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce); | 296 | m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce); |