aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs23
-rwxr-xr-xOpenSim/Region/Physics/BulletSPlugin/BSParam.cs6
2 files changed, 18 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
index 557c4e2..42381ef 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs
@@ -1,4 +1,4 @@
1/* 1/*
2 * Copyright (c) Contributors, http://opensimulator.org/ 2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders. 3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 * 4 *
@@ -227,7 +227,6 @@ public class BSActorAvatarMove : BSActor
227 stepVelocity.Z = m_controllingPrim.RawVelocity.Z; 227 stepVelocity.Z = m_controllingPrim.RawVelocity.Z;
228 } 228 }
229 229
230
231 // Colliding and not flying with an upward force. The avatar must be trying to jump. 230 // Colliding and not flying with an upward force. The avatar must be trying to jump.
232 if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0) 231 if (!m_controllingPrim.Flying && m_controllingPrim.IsColliding && stepVelocity.Z > 0)
233 { 232 {
@@ -259,23 +258,25 @@ public class BSActorAvatarMove : BSActor
259 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); 258 // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
260 } 259 }
261 260
262 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force. 261 //Alicia: Maintain minimum height when flying.
263 OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass; 262 // SL has a flying effect that keeps the avatar flying above the ground by some margin
264
265 // Add special movement force to allow avatars to walk up stepped surfaces.
266 moveForce += WalkUpStairs();
267
268 //Alicia: Maintain minimum height when flying
269 if (m_controllingPrim.Flying) 263 if (m_controllingPrim.Flying)
270 { 264 {
271 float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition) + 8f; 265 float hover_height = m_physicsScene.TerrainManager.GetTerrainHeightAtXYZ(m_controllingPrim.RawPosition)
266 + BSParam.AvatarFlyingGroundMargin;
272 267
273 if( m_controllingPrim.Position.Z < hover_height) 268 if( m_controllingPrim.Position.Z < hover_height)
274 { 269 {
275 moveForce.Z = moveForce.Z + 50f; 270 stepVelocity.Z += BSParam.AvatarFlyingGroundUpForce;
276 } 271 }
277 } 272 }
278 273
274 // 'stepVelocity' is now the speed we'd like the avatar to move in. Turn that into an instantanous force.
275 OMV.Vector3 moveForce = (stepVelocity - m_controllingPrim.RawVelocity) * m_controllingPrim.Mass;
276
277 // Add special movement force to allow avatars to walk up stepped surfaces.
278 moveForce += WalkUpStairs();
279
279 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}", 280 m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,move,stepVel={1},vel={2},mass={3},moveForce={4}",
280 m_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce); 281 m_controllingPrim.LocalID, stepVelocity, m_controllingPrim.RawVelocity, m_controllingPrim.Mass, moveForce);
281 m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce); 282 m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, moveForce);
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
index de42a4c..042e8a4 100755
--- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs
@@ -136,6 +136,8 @@ public static class BSParam
136 public static float AvatarHeightLowFudge { get; private set; } 136 public static float AvatarHeightLowFudge { get; private set; }
137 public static float AvatarHeightMidFudge { get; private set; } 137 public static float AvatarHeightMidFudge { get; private set; }
138 public static float AvatarHeightHighFudge { get; private set; } 138 public static float AvatarHeightHighFudge { get; private set; }
139 public static float AvatarFlyingGroundMargin { get; private set; }
140 public static float AvatarFlyingGroundUpForce { get; private set; }
139 public static float AvatarContactProcessingThreshold { get; private set; } 141 public static float AvatarContactProcessingThreshold { get; private set; }
140 public static float AvatarStopZeroThreshold { get; private set; } 142 public static float AvatarStopZeroThreshold { get; private set; }
141 public static int AvatarJumpFrames { get; private set; } 143 public static int AvatarJumpFrames { get; private set; }
@@ -583,6 +585,10 @@ public static class BSParam
583 0f ), 585 0f ),
584 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground", 586 new ParameterDefn<float>("AvatarHeightHighFudge", "A fudge factor to make tall avatars stand on the ground",
585 0f ), 587 0f ),
588 new ParameterDefn<float>("AvatarFlyingGroundMargin", "Meters avatar is kept above the ground when flying",
589 5f ),
590 new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin",
591 2.0f ),
586 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", 592 new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions",
587 0.1f ), 593 0.1f ),
588 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", 594 new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped",