diff options
author | Robert Adams | 2012-12-27 16:05:11 -0800 |
---|---|---|
committer | Robert Adams | 2012-12-27 22:12:27 -0800 |
commit | 7a5f598399c7373bd146061b478e6d04cb204879 (patch) | |
tree | ca14b47c2ffcb6f8717aa481830e79497bedb584 /OpenSim/Region | |
parent | Add check to always push terse updates for presences that have new velocities... (diff) | |
download | opensim-SC-7a5f598399c7373bd146061b478e6d04cb204879.zip opensim-SC-7a5f598399c7373bd146061b478e6d04cb204879.tar.gz opensim-SC-7a5f598399c7373bd146061b478e6d04cb204879.tar.bz2 opensim-SC-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')
4 files changed, 55 insertions, 39 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; |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index 4bed535..73b5764 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -182,9 +182,40 @@ public abstract class BSPhysObject : PhysicsActor | |||
182 | protected long CollidingStep { get; set; } | 182 | protected long CollidingStep { get; set; } |
183 | // The simulation step that last had a collision with the ground | 183 | // The simulation step that last had a collision with the ground |
184 | protected long CollidingGroundStep { get; set; } | 184 | protected long CollidingGroundStep { get; set; } |
185 | // The simulation step that last collided with an object | ||
186 | protected long CollidingObjectStep { get; set; } | ||
185 | // The collision flags we think are set in Bullet | 187 | // The collision flags we think are set in Bullet |
186 | protected CollisionFlags CurrentCollisionFlags { get; set; } | 188 | protected CollisionFlags CurrentCollisionFlags { get; set; } |
187 | 189 | ||
190 | public override bool IsColliding { | ||
191 | get { return (CollidingStep == PhysicsScene.SimulationStep); } | ||
192 | set { | ||
193 | if (value) | ||
194 | CollidingStep = PhysicsScene.SimulationStep; | ||
195 | else | ||
196 | CollidingStep = 0; | ||
197 | } | ||
198 | } | ||
199 | public override bool CollidingGround { | ||
200 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } | ||
201 | set | ||
202 | { | ||
203 | if (value) | ||
204 | CollidingGroundStep = PhysicsScene.SimulationStep; | ||
205 | else | ||
206 | CollidingGroundStep = 0; | ||
207 | } | ||
208 | } | ||
209 | public override bool CollidingObj { | ||
210 | get { return (CollidingObjectStep == PhysicsScene.SimulationStep); } | ||
211 | set { | ||
212 | if (value) | ||
213 | CollidingObjectStep = PhysicsScene.SimulationStep; | ||
214 | else | ||
215 | CollidingObjectStep = 0; | ||
216 | } | ||
217 | } | ||
218 | |||
188 | // The collisions that have been collected this tick | 219 | // The collisions that have been collected this tick |
189 | protected CollisionEventUpdate CollisionCollection; | 220 | protected CollisionEventUpdate CollisionCollection; |
190 | 221 | ||
@@ -196,12 +227,16 @@ public abstract class BSPhysObject : PhysicsActor | |||
196 | { | 227 | { |
197 | bool ret = false; | 228 | bool ret = false; |
198 | 229 | ||
199 | // The following lines make IsColliding() and IsCollidingGround() work | 230 | // The following lines make IsColliding(), CollidingGround() and CollidingObj work |
200 | CollidingStep = PhysicsScene.SimulationStep; | 231 | CollidingStep = PhysicsScene.SimulationStep; |
201 | if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID) | 232 | if (collidingWith <= PhysicsScene.TerrainManager.HighestTerrainID) |
202 | { | 233 | { |
203 | CollidingGroundStep = PhysicsScene.SimulationStep; | 234 | CollidingGroundStep = PhysicsScene.SimulationStep; |
204 | } | 235 | } |
236 | else | ||
237 | { | ||
238 | CollidingObjectStep = PhysicsScene.SimulationStep; | ||
239 | } | ||
205 | 240 | ||
206 | // prims in the same linkset cannot collide with each other | 241 | // prims in the same linkset cannot collide with each other |
207 | if (collidee != null && (this.Linkset.LinksetID == collidee.Linkset.LinksetID)) | 242 | if (collidee != null && (this.Linkset.LinksetID == collidee.Linkset.LinksetID)) |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index f804a0f..06e4ada 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | |||
@@ -915,18 +915,6 @@ public sealed class BSPrim : BSPhysObject | |||
915 | get { return _throttleUpdates; } | 915 | get { return _throttleUpdates; } |
916 | set { _throttleUpdates = value; } | 916 | set { _throttleUpdates = value; } |
917 | } | 917 | } |
918 | public override bool IsColliding { | ||
919 | get { return (CollidingStep == PhysicsScene.SimulationStep); } | ||
920 | set { _isColliding = value; } | ||
921 | } | ||
922 | public override bool CollidingGround { | ||
923 | get { return (CollidingGroundStep == PhysicsScene.SimulationStep); } | ||
924 | set { _collidingGround = value; } | ||
925 | } | ||
926 | public override bool CollidingObj { | ||
927 | get { return _collidingObj; } | ||
928 | set { _collidingObj = value; } | ||
929 | } | ||
930 | public bool IsPhantom { | 918 | public bool IsPhantom { |
931 | get { | 919 | get { |
932 | // SceneObjectPart removes phantom objects from the physics scene | 920 | // SceneObjectPart removes phantom objects from the physics scene |
@@ -1006,12 +994,12 @@ public sealed class BSPrim : BSPhysObject | |||
1006 | public override OMV.Vector3 PIDTarget { | 994 | public override OMV.Vector3 PIDTarget { |
1007 | set { _PIDTarget = value; } | 995 | set { _PIDTarget = value; } |
1008 | } | 996 | } |
1009 | public override bool PIDActive { | ||
1010 | set { _usePID = value; } | ||
1011 | } | ||
1012 | public override float PIDTau { | 997 | public override float PIDTau { |
1013 | set { _PIDTau = value; } | 998 | set { _PIDTau = value; } |
1014 | } | 999 | } |
1000 | public override bool PIDActive { | ||
1001 | set { _usePID = value; } | ||
1002 | } | ||
1015 | 1003 | ||
1016 | // Used for llSetHoverHeight and maybe vehicle height | 1004 | // Used for llSetHoverHeight and maybe vehicle height |
1017 | // Hover Height will override MoveTo target's Z | 1005 | // Hover Height will override MoveTo target's Z |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt index a66508a..16131cd 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt +++ b/OpenSim/Region/Physics/BulletSPlugin/BulletSimTODO.txt | |||
@@ -2,9 +2,10 @@ CURRENT PRIORITIES | |||
2 | ================================================= | 2 | ================================================= |
3 | Redo BulletSimAPI to allow native C# implementation of Bullet option. | 3 | Redo BulletSimAPI to allow native C# implementation of Bullet option. |
4 | Avatar movement | 4 | Avatar movement |
5 | flying into a wall doesn't stop avatar who keeps appearing to move through the obsticle | 5 | flying into a wall doesn't stop avatar who keeps appearing to move through the obstacle |
6 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) | 6 | walking up stairs is not calibrated correctly (stairs out of Kepler cabin) |
7 | avatar capsule rotation completed | 7 | avatar capsule rotation completed |
8 | llMoveToTarget | ||
8 | Enable vehicle border crossings (at least as poorly as ODE) | 9 | Enable vehicle border crossings (at least as poorly as ODE) |
9 | Terrain skirts | 10 | Terrain skirts |
10 | Avatar created in previous region and not new region when crossing border | 11 | Avatar created in previous region and not new region when crossing border |