diff options
author | Robert Adams | 2014-06-18 22:39:28 -0700 |
---|---|---|
committer | Justin Clark-Casey | 2014-08-02 00:49:24 +0100 |
commit | b293242017e88118a5c260d4900090b04b3f8383 (patch) | |
tree | 45cfd6ab5e592025cbe58257fed5b95fe4b26a83 /OpenSim/Region/Physics/BulletSPlugin | |
parent | refactor: Simplify compilation result tests by factoring out common code. (diff) | |
download | opensim-SC_OLD-b293242017e88118a5c260d4900090b04b3f8383.zip opensim-SC_OLD-b293242017e88118a5c260d4900090b04b3f8383.tar.gz opensim-SC_OLD-b293242017e88118a5c260d4900090b04b3f8383.tar.bz2 opensim-SC_OLD-b293242017e88118a5c260d4900090b04b3f8383.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')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 23 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 6 |
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", |