diff options
author | Robert Adams | 2013-07-18 19:09:55 -0700 |
---|---|---|
committer | Robert Adams | 2013-07-18 19:09:55 -0700 |
commit | 1d65b0d80296a672c8023293aee7d0a01bad4066 (patch) | |
tree | 5455a7a3f66d8fee8c7fc9394fc0df880a834441 /OpenSim/Region/Physics | |
parent | Enable storing of environment settings in NullSimulationData (diff) | |
download | opensim-SC-1d65b0d80296a672c8023293aee7d0a01bad4066.zip opensim-SC-1d65b0d80296a672c8023293aee7d0a01bad4066.tar.gz opensim-SC-1d65b0d80296a672c8023293aee7d0a01bad4066.tar.bz2 opensim-SC-1d65b0d80296a672c8023293aee7d0a01bad4066.tar.xz |
BulletSim: add position resetting for stationary avatars so they don't
move around when standing on a stationary object.
Create proper linkage between BSCharacter and its actor by generating
a UpdatedProperties event the same way BSPrim does.
Diffstat (limited to 'OpenSim/Region/Physics')
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSActorAvatarMove.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 8 |
2 files changed, 20 insertions, 5 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); |