aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
diff options
context:
space:
mode:
authorRobert Adams2012-12-27 16:05:11 -0800
committerRobert Adams2012-12-27 22:12:27 -0800
commit7a5f598399c7373bd146061b478e6d04cb204879 (patch)
treeca14b47c2ffcb6f8717aa481830e79497bedb584 /OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
parentAdd check to always push terse updates for presences that have new velocities... (diff)
downloadopensim-SC_OLD-7a5f598399c7373bd146061b478e6d04cb204879.zip
opensim-SC_OLD-7a5f598399c7373bd146061b478e6d04cb204879.tar.gz
opensim-SC_OLD-7a5f598399c7373bd146061b478e6d04cb204879.tar.bz2
opensim-SC_OLD-7a5f598399c7373bd146061b478e6d04cb204879.tar.xz
BulletSim: move logic for IsColliding, CollidingGround and CollidingObj from individual sub-classes and up to parent BSPhysObject class.
Diffstat (limited to 'OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs')
-rw-r--r--OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs36
1 files changed, 14 insertions, 22 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
index cbc1772..3f7b5e1 100644
--- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
+++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs
@@ -584,18 +584,6 @@ public sealed class BSCharacter : BSPhysObject
584 get { return _throttleUpdates; } 584 get { return _throttleUpdates; }
585 set { _throttleUpdates = value; } 585 set { _throttleUpdates = value; }
586 } 586 }
587 public override bool IsColliding {
588 get { return (CollidingStep == PhysicsScene.SimulationStep); }
589 set { _isColliding = value; }
590 }
591 public override bool CollidingGround {
592 get { return (CollidingGroundStep == PhysicsScene.SimulationStep); }
593 set { CollidingGround = value; }
594 }
595 public override bool CollidingObj {
596 get { return _collidingObj; }
597 set { _collidingObj = value; }
598 }
599 public override bool FloatOnWater { 587 public override bool FloatOnWater {
600 set { 588 set {
601 _floatOnWater = value; 589 _floatOnWater = value;
@@ -769,22 +757,26 @@ public sealed class BSCharacter : BSPhysObject
769 757
770 OMV.Vector3 stepVelocity = _velocityMotor.Step(PhysicsScene.LastTimeStep); 758 OMV.Vector3 stepVelocity = _velocityMotor.Step(PhysicsScene.LastTimeStep);
771 759
772 // If falling, we keep the world's downward vector no matter what the other axis specify. 760 // Check for cases to turn off the motor.
773 if (!Flying && !IsColliding) 761 if (
774 { 762 // If the walking motor is all done, turn it off
775 stepVelocity.Z = entprop.Velocity.Z; 763 (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero) )
776 DetailLog("{0},BSCharacter.UpdateProperties,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
777 }
778
779 // If the user has said stop and we've stopped applying velocity correction,
780 // the motor can be turned off. Set the velocity to zero so the zero motion is sent to the viewer.
781 if (_velocityMotor.TargetValue.ApproxEquals(OMV.Vector3.Zero, 0.01f) && _velocityMotor.ErrorIsZero)
782 { 764 {
783 ZeroMotion(true); 765 ZeroMotion(true);
784 stepVelocity = OMV.Vector3.Zero; 766 stepVelocity = OMV.Vector3.Zero;
785 _velocityMotor.Enabled = false; 767 _velocityMotor.Enabled = false;
786 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor); 768 DetailLog("{0},BSCharacter.UpdateProperties,taint,disableVelocityMotor,m={1}", LocalID, _velocityMotor);
787 } 769 }
770 else
771 {
772 // If the motor is not being turned off...
773 // If falling, we keep the world's downward vector no matter what the other axis specify.
774 if (!Flying && !IsColliding)
775 {
776 stepVelocity.Z = entprop.Velocity.Z;
777 DetailLog("{0},BSCharacter.UpdateProperties,taint,overrideStepZWithWorldZ,stepVel={1}", LocalID, stepVelocity);
778 }
779 }
788 780
789 _velocity = stepVelocity; 781 _velocity = stepVelocity;
790 entprop.Velocity = _velocity; 782 entprop.Velocity = _velocity;