diff options
author | Vegaslon | 2014-06-20 09:34:07 -0400 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-06-27 23:34:34 +0100 |
commit | abf85b7f192e167ed5f462ac8d1a8de365e4f03b (patch) | |
tree | 0e00b14be8f05255318d04ab20aa6ead7fb66ccf | |
parent | add LSL constants PRIM_SPECULAR and PRIM_NORMAL (diff) | |
download | opensim-SC-abf85b7f192e167ed5f462ac8d1a8de365e4f03b.zip opensim-SC-abf85b7f192e167ed5f462ac8d1a8de365e4f03b.tar.gz opensim-SC-abf85b7f192e167ed5f462ac8d1a8de365e4f03b.tar.bz2 opensim-SC-abf85b7f192e167ed5f462ac8d1a8de365e4f03b.tar.xz |
Bulletsim: Create AvatarTerminalVelocity to BulletSim like what ODE and SL has. Before this falling from really high caused the avatar to fall faster then the veiwer can handle and cause camera issues.
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 24 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | 3 | ||||
-rw-r--r-- | bin/OpenSimDefaults.ini | 5 |
3 files changed, 30 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 42381ef..14518e9 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -205,6 +205,17 @@ public class BSActorAvatarMove : BSActor | |||
205 | // Flying and not colliding and velocity nearly zero. | 205 | // Flying and not colliding and velocity nearly zero. |
206 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); | 206 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); |
207 | } | 207 | } |
208 | else | ||
209 | { | ||
210 | //We are falling but are not touching any keys make sure not falling too fast | ||
211 | if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity) | ||
212 | { | ||
213 | |||
214 | OMV.Vector3 slowingForce = new OMV.Vector3(0f, 0f, BSParam.AvatarTerminalVelocity - m_controllingPrim.RawVelocity.Z) * m_controllingPrim.Mass; | ||
215 | m_physicsScene.PE.ApplyCentralImpulse(m_controllingPrim.PhysBody, slowingForce); | ||
216 | } | ||
217 | |||
218 | } | ||
208 | } | 219 | } |
209 | 220 | ||
210 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", | 221 | m_physicsScene.DetailLog("{0},BSCharacter.MoveMotor,taint,stopping,target={1},colliding={2}", |
@@ -252,8 +263,17 @@ public class BSActorAvatarMove : BSActor | |||
252 | } | 263 | } |
253 | else | 264 | else |
254 | { | 265 | { |
255 | // Since we're not affected by anything, whatever vertical motion the avatar has, continue that. | 266 | |
256 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; | 267 | // Since we're not affected by anything, the avatar must be falling and we do not want that to be too fast. |
268 | if (m_controllingPrim.RawVelocity.Z < BSParam.AvatarTerminalVelocity) | ||
269 | { | ||
270 | |||
271 | stepVelocity.Z = BSParam.AvatarTerminalVelocity; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | stepVelocity.Z = m_controllingPrim.RawVelocity.Z; | ||
276 | } | ||
257 | } | 277 | } |
258 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); | 278 | // DetailLog("{0},BSCharacter.MoveMotor,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity); |
259 | } | 279 | } |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 042e8a4..8b4df05 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs | |||
@@ -138,6 +138,7 @@ public static class BSParam | |||
138 | public static float AvatarHeightHighFudge { get; private set; } | 138 | public static float AvatarHeightHighFudge { get; private set; } |
139 | public static float AvatarFlyingGroundMargin { get; private set; } | 139 | public static float AvatarFlyingGroundMargin { get; private set; } |
140 | public static float AvatarFlyingGroundUpForce { get; private set; } | 140 | public static float AvatarFlyingGroundUpForce { get; private set; } |
141 | public static float AvatarTerminalVelocity { get; private set; } | ||
141 | public static float AvatarContactProcessingThreshold { get; private set; } | 142 | public static float AvatarContactProcessingThreshold { get; private set; } |
142 | public static float AvatarStopZeroThreshold { get; private set; } | 143 | public static float AvatarStopZeroThreshold { get; private set; } |
143 | public static int AvatarJumpFrames { get; private set; } | 144 | public static int AvatarJumpFrames { get; private set; } |
@@ -589,6 +590,8 @@ public static class BSParam | |||
589 | 5f ), | 590 | 5f ), |
590 | new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin", | 591 | new ParameterDefn<float>("AvatarFlyingGroundUpForce", "Upward force applied to the avatar to keep it at flying ground margin", |
591 | 2.0f ), | 592 | 2.0f ), |
593 | new ParameterDefn<float>("AvatarTerminalVelocity", "Terminal Velocity of falling avatar", | ||
594 | -54.0f ), | ||
592 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", | 595 | new ParameterDefn<float>("AvatarContactProcessingThreshold", "Distance from capsule to check for collisions", |
593 | 0.1f ), | 596 | 0.1f ), |
594 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", | 597 | new ParameterDefn<float>("AvatarStopZeroThreshold", "Movement velocity below which avatar is assumed to be stopped", |
diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 8b8364c..3f373ce 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini | |||
@@ -1038,6 +1038,11 @@ | |||
1038 | AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range | 1038 | AvatarHeightMidFudge = 0 ; Adjustment at mid point of avatar height range |
1039 | AvatarHeightHighFudge = 0 ; Adjustment at high end of height range | 1039 | AvatarHeightHighFudge = 0 ; Adjustment at high end of height range |
1040 | 1040 | ||
1041 | ; Terminal velocity of a falling avatar | ||
1042 | ; This is the same http://en.wikipedia.org/wiki/Terminal_velocity#Examples | ||
1043 | ; negative for a downward speed. | ||
1044 | AvatarTerminalVelocity = -54 | ||
1045 | |||
1041 | ; Default linkset implmentation | 1046 | ; Default linkset implmentation |
1042 | ; 'Constraint' uses physics constraints to hold linkset together. 'Compound' | 1047 | ; 'Constraint' uses physics constraints to hold linkset together. 'Compound' |
1043 | ; builds a compound shape from the children shapes to create a single physical | 1048 | ; builds a compound shape from the children shapes to create a single physical |