diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4ad8b11098..b008e6698d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -307,9 +307,6 @@ namespace OpenSim.Region.Framework.Scenes get { return RootPart.VolumeDetectActive; } } - private Vector3 lastPhysGroupPos; - private Quaternion lastPhysGroupRot; - private bool m_isBackedUp; public bool IsBackedUp @@ -2525,6 +2522,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion + public override void Update() { // Check that the group was not deleted before the scheduled update @@ -2543,19 +2541,8 @@ namespace OpenSim.Region.Framework.Scenes // check to see if the physical position or rotation warrant an update. if (m_rootPart.UpdateFlag == UpdateRequired.NONE) { - bool UsePhysics = ((RootPart.Flags & PrimFlags.Physics) != 0); - - if (UsePhysics && !AbsolutePosition.ApproxEquals(lastPhysGroupPos, 0.02f)) - { - m_rootPart.UpdateFlag = UpdateRequired.TERSE; - lastPhysGroupPos = AbsolutePosition; - } - - if (UsePhysics && !GroupRotation.ApproxEquals(lastPhysGroupRot, 0.1f)) - { - m_rootPart.UpdateFlag = UpdateRequired.TERSE; - lastPhysGroupRot = GroupRotation; - } + // rootpart SendScheduledUpdates will check if a update is needed + m_rootPart.UpdateFlag = UpdateRequired.TERSE; } SceneObjectPart[] parts = m_parts.GetArray(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2191cfa4d4..ff4ae85f1f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Framework.Scenes /// public bool IsRoot { - get { return ParentGroup.RootPart == this; } + get { return Object.ReferenceEquals(ParentGroup.RootPart, this); } } /// @@ -319,7 +319,7 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastVelocity; protected Vector3 m_lastAcceleration; protected Vector3 m_lastAngularVelocity; - protected int m_lastTerseSent; + protected int m_lastUpdateSentTime; protected float m_buoyancy = 0.0f; protected Vector3 m_force; protected Vector3 m_torque; @@ -3198,6 +3198,14 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null) return; + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar) { SendFullUpdate(avatar.ControllingClient); @@ -3271,17 +3279,10 @@ namespace OpenSim.Region.Framework.Scenes Velocity.ApproxEquals(Vector3.Zero, VELOCITY_TOLERANCE) || !AngularVelocity.ApproxEquals(m_lastAngularVelocity, VELOCITY_TOLERANCE) || !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || - Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) + Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) { SendTerseUpdateToAllClients(); - // Update the "last" values - m_lastPosition = OffsetPosition; - m_lastRotation = RotationOffset; - m_lastVelocity = Velocity; - m_lastAcceleration = Acceleration; - m_lastAngularVelocity = AngularVelocity; - m_lastTerseSent = Environment.TickCount; } break; } @@ -3302,6 +3303,14 @@ namespace OpenSim.Region.Framework.Scenes if (ParentGroup == null || ParentGroup.Scene == null) return; + // Update the "last" values + m_lastPosition = OffsetPosition; + m_lastRotation = RotationOffset; + m_lastVelocity = Velocity; + m_lastAcceleration = Acceleration; + m_lastAngularVelocity = AngularVelocity; + m_lastUpdateSentTime = Environment.TickCount; + ParentGroup.Scene.ForEachClient(delegate(IClientAPI client) { SendTerseUpdateToClient(client);