use getters instead of member variables in velocity network filter code and add some more descriptive comments.
parent
13ab00e45a
commit
4c59d57596
|
@ -2415,17 +2415,19 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate;
|
Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate;
|
||||||
|
|
||||||
float absoluteDistanceError = (float)Math.Abs(Vector3.Distance(m_pos, expectedPosition));
|
float distanceError = Vector3.Distance(OffsetPosition, expectedPosition);
|
||||||
|
|
||||||
|
float speed = Velocity.Length();
|
||||||
|
float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
|
||||||
|
|
||||||
if (m_velocity.Length() < 0.01f
|
if (speed < 0.01f // allow rotation updates if avatar position is unchanged
|
||||||
|| absoluteDistanceError > 0.25f // arbitrary distance error threshold
|
|| Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold
|
||||||
|| Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f)
|
|| velocidyDiff > 0.01f) // did velocity change from last update?
|
||||||
{
|
{
|
||||||
m_perfMonMS = currentTick;
|
m_perfMonMS = currentTick;
|
||||||
lastVelocitySentToAllClients = m_velocity;
|
lastVelocitySentToAllClients = Velocity;
|
||||||
lastTerseUpdateToAllClientsTick = currentTick;
|
lastTerseUpdateToAllClientsTick = currentTick;
|
||||||
lastPositionSentToAllClients = m_pos;
|
lastPositionSentToAllClients = OffsetPosition;
|
||||||
|
|
||||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue