aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorAliciaRaven2014-06-17 16:55:33 +0100
committerJustin Clark-Casey2014-08-02 00:48:55 +0100
commitfa1f6031ca8230e66f50dbf9fdd067e581d05751 (patch)
tree50156dff0c80516102afa1a20ba8019eac6e8758
parentChange flavour to post-fixes (diff)
downloadopensim-SC_OLD-fa1f6031ca8230e66f50dbf9fdd067e581d05751.zip
opensim-SC_OLD-fa1f6031ca8230e66f50dbf9fdd067e581d05751.tar.gz
opensim-SC_OLD-fa1f6031ca8230e66f50dbf9fdd067e581d05751.tar.bz2
opensim-SC_OLD-fa1f6031ca8230e66f50dbf9fdd067e581d05751.tar.xz
Add upward force to flight when close to the ground. Prevents current belly flop to the floor when flying with bullet physics and acts more like ODE and SL flight.
Signed-off-by: Michael Cerquoni <nebadon2025@gmail.com>
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs26
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);