aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics
diff options
context:
space:
mode:
authorRobert Adams2013-03-31 22:16:34 -0700
committerRobert Adams2013-03-31 22:19:44 -0700
commit84eb25da23765b3a4f7ae5513e8a238680bb99f2 (patch)
tree7c2e99fa268773aba02331d071d54d8adbce8276 /OpenSim/Region/Physics
parentBulletSim: not quite functional axis lock code. (diff)
downloadopensim-SC_OLD-84eb25da23765b3a4f7ae5513e8a238680bb99f2.zip
opensim-SC_OLD-84eb25da23765b3a4f7ae5513e8a238680bb99f2.tar.gz
opensim-SC_OLD-84eb25da23765b3a4f7ae5513e8a238680bb99f2.tar.bz2
opensim-SC_OLD-84eb25da23765b3a4f7ae5513e8a238680bb99f2.tar.xz
BulletSim: stop an avatar from moving if standing on a stationary
object. This will stop avatars from sliding down steep terrains or objects while still allowing an avatar to be moved if standing on a moving object.
Diffstat (limited to 'OpenSim/Region/Physics')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs9
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index 90c2d9c..25be416 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -61,6 +61,7 @@ public sealed class BSCharacter : BSPhysObject
61 private OMV.Vector3 _rotationalVelocity; 61 private OMV.Vector3 _rotationalVelocity;
62 private bool _kinematic; 62 private bool _kinematic;
63 private float _buoyancy; 63 private float _buoyancy;
64 private bool _isStationaryStanding; // true is standing on a stationary object
64 65
65 private BSVMotor _velocityMotor; 66 private BSVMotor _velocityMotor;
66 67
@@ -84,6 +85,7 @@ public sealed class BSCharacter : BSPhysObject
84 _buoyancy = ComputeBuoyancyFromFlying(isFlying); 85 _buoyancy = ComputeBuoyancyFromFlying(isFlying);
85 Friction = BSParam.AvatarStandingFriction; 86 Friction = BSParam.AvatarStandingFriction;
86 Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor; 87 Density = BSParam.AvatarDensity / BSParam.DensityScaleFactor;
88 _isStationaryStanding = false;
87 89
88 // Old versions of ScenePresence passed only the height. If width and/or depth are zero, 90 // Old versions of ScenePresence passed only the height. If width and/or depth are zero,
89 // replace with the default values. 91 // replace with the default values.
@@ -208,6 +210,7 @@ public sealed class BSCharacter : BSPhysObject
208 // The code below uses whether the collider is static or moving to decide whether to zero motion. 210 // The code below uses whether the collider is static or moving to decide whether to zero motion.
209 211
210 _velocityMotor.Step(timeStep); 212 _velocityMotor.Step(timeStep);
213 _isStationaryStanding = false;
211 214
212 // If we're not supposed to be moving, make sure things are zero. 215 // If we're not supposed to be moving, make sure things are zero.
213 if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero) 216 if (_velocityMotor.ErrorIsZero() && _velocityMotor.TargetValue == OMV.Vector3.Zero)
@@ -221,6 +224,7 @@ public sealed class BSCharacter : BSPhysObject
221 if (!ColliderIsMoving) 224 if (!ColliderIsMoving)
222 { 225 {
223 DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID); 226 DetailLog("{0},BSCharacter.MoveMotor,collidingWithStationary,zeroingMotion", LocalID);
227 _isStationaryStanding = true;
224 ZeroMotion(true /* inTaintTime */); 228 ZeroMotion(true /* inTaintTime */);
225 } 229 }
226 230
@@ -882,7 +886,10 @@ public sealed class BSCharacter : BSPhysObject
882 // the world that things have changed. 886 // the world that things have changed.
883 public override void UpdateProperties(EntityProperties entprop) 887 public override void UpdateProperties(EntityProperties entprop)
884 { 888 {
885 _position = entprop.Position; 889 // Don't change position if standing on a stationary object.
890 if (!_isStationaryStanding)
891 _position = entprop.Position;
892
886 _orientation = entprop.Rotation; 893 _orientation = entprop.Rotation;
887 894
888 // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar 895 // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar