diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9bf5bea36b..1c892fed69 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1997,8 +1997,6 @@ namespace OpenSim.Region.Framework.Scenes if (part.SitTargetAvatar == UUID) part.SitTargetAvatar = UUID.Zero; - part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); - ParentPosition = part.GetWorldPosition(); ControllingClient.SendClearFollowCamProperties(part.ParentUUID); } @@ -2052,6 +2050,9 @@ namespace OpenSim.Region.Framework.Scenes m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); SendAvatarDataToAllAgents(); m_requestedSitTargetID = 0; + + if (part != null) + part.ParentGroup.TriggerScriptChangedEvent(Changed.LINK); } Animator.UpdateMovementAnimations(); diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index f93d7bac0e..19d87c29a7 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -100,7 +100,14 @@ namespace OpenSim.Region.Physics.OdePlugin private bool m_hackSentFall = false; private bool m_hackSentFly = false; private int m_requestedUpdateFrequency = 0; - private Vector3 m_taintPosition = Vector3.Zero; + private Vector3 m_taintPosition; + + /// + /// Hold set forces so we can process them outside physics calculations. This prevents race conditions if we set force + /// while calculatios are going on + /// + private Vector3 m_taintForce; + internal uint m_localID = 0; // taints and their non-tainted counterparts private bool m_isPhysical = false; // the current physical status @@ -832,7 +839,10 @@ namespace OpenSim.Region.Physics.OdePlugin { m_pidControllerActive = false; force *= 100f; - doForce(force); + m_taintForce += force; + _parent_scene.AddPhysicsActorTaint(this); + + //doForce(force); // If uncommented, things get pushed off world // // m_log.Debug("Push!"); @@ -1250,6 +1260,19 @@ namespace OpenSim.Region.Physics.OdePlugin } } + if (m_taintForce != Vector3.Zero) + { + if (Body != IntPtr.Zero) + { + // FIXME: This is not a good solution since it's subject to a race condition if a force is another + // thread sets a new force while we're in this loop (since it could be obliterated by + // m_taintForce = Vector3.Zero. Need to lock ProcessTaints() when we set a new tainted force. + doForce(m_taintForce); + } + + m_taintForce = Vector3.Zero; + } + if (m_taintTargetVelocity != _target_velocity) _target_velocity = m_taintTargetVelocity;