From cdbeb8b83b671df1ffb6bf7890c64a27e4a85730 Mon Sep 17 00:00:00 2001 From: John Hurliman Date: Wed, 28 Oct 2009 03:21:53 -0700 Subject: [PATCH] Track timestamps when terse updates were last sent for a prim or avatar to avoid floating away forever until a key is pressed (deviates from SL behavior in a hopefully good way) --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 9b11582d7b..e1588ceebc 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -253,6 +253,7 @@ namespace OpenSim.Region.Framework.Scenes protected Vector3 m_lastVelocity; protected Vector3 m_lastAcceleration; protected Vector3 m_lastAngularVelocity; + protected int m_lastTerseSent; // TODO: Those have to be changed into persistent properties at some later point, // or sit-camera on vehicles will break on sim-crossing. @@ -2395,6 +2396,7 @@ if (m_shape != null) { { const float VELOCITY_TOLERANCE = 0.01f; const float POSITION_TOLERANCE = 0.1f; + const int TIME_MS_TOLERANCE = 3000; if (m_updateFlag == 1) { @@ -2403,7 +2405,8 @@ if (m_shape != null) { Acceleration != m_lastAcceleration || (Velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || (RotationalVelocity - m_lastAngularVelocity).Length() > VELOCITY_TOLERANCE || - (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE) + (OffsetPosition - m_lastPosition).Length() > POSITION_TOLERANCE || + Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { AddTerseUpdateToAllAvatars(); ClearUpdateSchedule(); @@ -2422,6 +2425,7 @@ if (m_shape != null) { m_lastVelocity = Velocity; m_lastAcceleration = Acceleration; m_lastAngularVelocity = RotationalVelocity; + m_lastTerseSent = Environment.TickCount; } } else diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 87fac0c5e7..92f00c44b4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -96,6 +96,7 @@ namespace OpenSim.Region.Framework.Scenes private Vector3 m_lastPosition; private Quaternion m_lastRotation; private Vector3 m_lastVelocity; + private int m_lastTerseSent; private bool m_updateflag; private byte m_movementflag; @@ -2363,6 +2364,7 @@ namespace OpenSim.Region.Framework.Scenes { const float VELOCITY_TOLERANCE = 0.01f; const float POSITION_TOLERANCE = 10.0f; + const int TIME_MS_TOLERANCE = 3000; SendPrimUpdates(); @@ -2377,7 +2379,8 @@ namespace OpenSim.Region.Framework.Scenes // Throw away duplicate or insignificant updates if (m_bodyRot != m_lastRotation || (m_velocity - m_lastVelocity).Length() > VELOCITY_TOLERANCE || - (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE) + (m_pos - m_lastPosition).Length() > POSITION_TOLERANCE || + Environment.TickCount - m_lastTerseSent > TIME_MS_TOLERANCE) { SendTerseUpdateToAllClients(); @@ -2385,6 +2388,7 @@ namespace OpenSim.Region.Framework.Scenes m_lastPosition = m_pos; m_lastRotation = m_bodyRot; m_lastVelocity = m_velocity; + m_lastTerseSent = Environment.TickCount; } // followed suggestion from mic bowman. reversed the two lines below.