diff options
author | Robert Adams | 2014-06-18 22:39:28 -0700 |
---|---|---|
committer | Robert Adams | 2014-06-18 22:39:28 -0700 |
commit | f348928590de1b7044801f72d3c415cb10175d45 (patch) | |
tree | c9ba5d05adeb7f45d048b49e1546ef0e36edf834 /OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |
parent | refactor: Simplify compilation result tests by factoring out common code. (diff) | |
download | opensim-SC-f348928590de1b7044801f72d3c415cb10175d45.zip opensim-SC-f348928590de1b7044801f72d3c415cb10175d45.tar.gz opensim-SC-f348928590de1b7044801f72d3c415cb10175d45.tar.bz2 opensim-SC-f348928590de1b7044801f72d3c415cb10175d45.tar.xz |
BulletSim: more tweeks to AliciaRaven's flying mods. Added parameters
AvatarFlyingGroundMargin and AvatarFlyingGroundUpForce set to 5.0 and
2.0 respectively which seems to give about the same action as in SL.
Also moved force addition to before the velocity to force computation
so the upward velocity is properly applied to the avatar mass.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 23 |
1 files changed, 12 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); |