diff options
Diffstat (limited to '')
4 files changed, 30 insertions, 11 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs index 928b350..0f11c4a 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | |||
@@ -130,6 +130,7 @@ public class BSActorAvatarMove : BSActor | |||
130 | SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */); | 130 | SetVelocityAndTarget(m_controllingPrim.RawVelocity, m_controllingPrim.TargetVelocity, true /* inTaintTime */); |
131 | 131 | ||
132 | m_physicsScene.BeforeStep += Mover; | 132 | m_physicsScene.BeforeStep += Mover; |
133 | m_controllingPrim.OnPreUpdateProperty += Process_OnPreUpdateProperty; | ||
133 | 134 | ||
134 | m_walkingUpStairs = 0; | 135 | m_walkingUpStairs = 0; |
135 | } | 136 | } |
@@ -139,6 +140,7 @@ public class BSActorAvatarMove : BSActor | |||
139 | { | 140 | { |
140 | if (m_velocityMotor != null) | 141 | if (m_velocityMotor != null) |
141 | { | 142 | { |
143 | m_controllingPrim.OnPreUpdateProperty -= Process_OnPreUpdateProperty; | ||
142 | m_physicsScene.BeforeStep -= Mover; | 144 | m_physicsScene.BeforeStep -= Mover; |
143 | m_velocityMotor = null; | 145 | m_velocityMotor = null; |
144 | } | 146 | } |
@@ -197,7 +199,7 @@ public class BSActorAvatarMove : BSActor | |||
197 | { | 199 | { |
198 | if (m_controllingPrim.Flying) | 200 | if (m_controllingPrim.Flying) |
199 | { | 201 | { |
200 | // Flying and not collising and velocity nearly zero. | 202 | // Flying and not colliding and velocity nearly zero. |
201 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); | 203 | m_controllingPrim.ZeroMotion(true /* inTaintTime */); |
202 | } | 204 | } |
203 | } | 205 | } |
@@ -266,6 +268,19 @@ public class BSActorAvatarMove : BSActor | |||
266 | } | 268 | } |
267 | } | 269 | } |
268 | 270 | ||
271 | // Called just as the property update is received from the physics engine. | ||
272 | // Do any mode necessary for avatar movement. | ||
273 | private void Process_OnPreUpdateProperty(ref EntityProperties entprop) | ||
274 | { | ||
275 | // Don't change position if standing on a stationary object. | ||
276 | if (m_controllingPrim.IsStationary) | ||
277 | { | ||
278 | entprop.Position = m_controllingPrim.RawPosition; | ||
279 | m_physicsScene.PE.SetTranslation(m_controllingPrim.PhysBody, entprop.Position, entprop.Rotation); | ||
280 | } | ||
281 | |||
282 | } | ||
283 | |||
269 | // Decide if the character is colliding with a low object and compute a force to pop the | 284 | // Decide if the character is colliding with a low object and compute a force to pop the |
270 | // avatar up so it can walk up and over the low objects. | 285 | // avatar up so it can walk up and over the low objects. |
271 | private OMV.Vector3 WalkUpStairs() | 286 | private OMV.Vector3 WalkUpStairs() |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index c9e3ca0..59e7f5f 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -709,10 +709,10 @@ public sealed class BSCharacter : BSPhysObject | |||
709 | // the world that things have changed. | 709 | // the world that things have changed. |
710 | public override void UpdateProperties(EntityProperties entprop) | 710 | public override void UpdateProperties(EntityProperties entprop) |
711 | { | 711 | { |
712 | // Don't change position if standing on a stationary object. | 712 | // Let anyone (like the actors) modify the updated properties before they are pushed into the object and the simulator. |
713 | if (!IsStationary) | 713 | TriggerPreUpdatePropertyAction(ref entprop); |
714 | RawPosition = entprop.Position; | ||
715 | 714 | ||
715 | RawPosition = entprop.Position; | ||
716 | RawOrientation = entprop.Rotation; | 716 | RawOrientation = entprop.Rotation; |
717 | 717 | ||
718 | // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar | 718 | // Smooth velocity. OpenSimulator is VERY sensitive to changes in velocity of the avatar |
@@ -740,7 +740,7 @@ public sealed class BSCharacter : BSPhysObject | |||
740 | // Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); | 740 | // Linkset.UpdateProperties(UpdatedProperties.EntPropUpdates, this); |
741 | 741 | ||
742 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. | 742 | // Avatars don't report their changes the usual way. Changes are checked for in the heartbeat loop. |
743 | // base.RequestPhysicsterseUpdate(); | 743 | // PhysScene.PostUpdate(this); |
744 | 744 | ||
745 | DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", | 745 | DetailLog("{0},BSCharacter.UpdateProperties,call,pos={1},orient={2},vel={3},accel={4},rotVel={5}", |
746 | LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity); | 746 | LocalID, RawPosition, RawOrientation, RawVelocity, _acceleration, _rotationalVelocity); |
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index a41eaf8..fc4545f 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -103,9 +103,10 @@ public abstract class BSPhysObject : PhysicsActor | |||
103 | CollisionsLastTickStep = -1; | 103 | CollisionsLastTickStep = -1; |
104 | 104 | ||
105 | SubscribedEventsMs = 0; | 105 | SubscribedEventsMs = 0; |
106 | CollidingStep = 0; | 106 | // Crazy values that will never be true |
107 | CollidingGroundStep = 0; | 107 | CollidingStep = BSScene.NotASimulationStep; |
108 | CollisionAccumulation = 0; | 108 | CollidingGroundStep = BSScene.NotASimulationStep; |
109 | CollisionAccumulation = BSScene.NotASimulationStep; | ||
109 | ColliderIsMoving = false; | 110 | ColliderIsMoving = false; |
110 | CollisionScore = 0; | 111 | CollisionScore = 0; |
111 | 112 | ||
@@ -349,7 +350,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
349 | if (value) | 350 | if (value) |
350 | CollidingStep = PhysScene.SimulationStep; | 351 | CollidingStep = PhysScene.SimulationStep; |
351 | else | 352 | else |
352 | CollidingStep = 0; | 353 | CollidingStep = BSScene.NotASimulationStep; |
353 | } | 354 | } |
354 | } | 355 | } |
355 | public override bool CollidingGround { | 356 | public override bool CollidingGround { |
@@ -359,7 +360,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
359 | if (value) | 360 | if (value) |
360 | CollidingGroundStep = PhysScene.SimulationStep; | 361 | CollidingGroundStep = PhysScene.SimulationStep; |
361 | else | 362 | else |
362 | CollidingGroundStep = 0; | 363 | CollidingGroundStep = BSScene.NotASimulationStep; |
363 | } | 364 | } |
364 | } | 365 | } |
365 | public override bool CollidingObj { | 366 | public override bool CollidingObj { |
@@ -368,7 +369,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
368 | if (value) | 369 | if (value) |
369 | CollidingObjectStep = PhysScene.SimulationStep; | 370 | CollidingObjectStep = PhysScene.SimulationStep; |
370 | else | 371 | else |
371 | CollidingObjectStep = 0; | 372 | CollidingObjectStep = BSScene.NotASimulationStep; |
372 | } | 373 | } |
373 | } | 374 | } |
374 | 375 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 214271b..41aca3b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | |||
@@ -97,6 +97,9 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters | |||
97 | 97 | ||
98 | internal long m_simulationStep = 0; // The current simulation step. | 98 | internal long m_simulationStep = 0; // The current simulation step. |
99 | public long SimulationStep { get { return m_simulationStep; } } | 99 | public long SimulationStep { get { return m_simulationStep; } } |
100 | // A number to use for SimulationStep that is probably not any step value | ||
101 | // Used by the collision code (which remembers the step when a collision happens) to remember not any simulation step. | ||
102 | public static long NotASimulationStep = -1234; | ||
100 | 103 | ||
101 | internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() | 104 | internal float LastTimeStep { get; private set; } // The simulation time from the last invocation of Simulate() |
102 | 105 | ||