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)

0.6.8-post-fixes
John Hurliman 2009-10-28 03:21:53 -07:00
parent 587c35f6b6
commit cdbeb8b83b
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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.