aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorAliciaRaven2014-06-17 16:55:33 +0100
committerMichael Cerquoni2014-06-17 21:47:36 -0400
commitff892b5bcff640ddc27fe1003a7d90a475f00fb2 (patch)
treee9c21b29a5cb628eaaa23369318b4085f3dfef5a /OpenSim/Region
parentChange assembly versions to 0.8.1 (diff)
downloadopensim-SC-ff892b5bcff640ddc27fe1003a7d90a475f00fb2.zip
opensim-SC-ff892b5bcff640ddc27fe1003a7d90a475f00fb2.tar.gz
opensim-SC-ff892b5bcff640ddc27fe1003a7d90a475f00fb2.tar.bz2
opensim-SC-ff892b5bcff640ddc27fe1003a7d90a475f00fb2.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>
Diffstat (limited to 'OpenSim/Region')
-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);