From 4c59d57596d8c955a3634d9ffc35b4557e0b56fe Mon Sep 17 00:00:00 2001 From: dahlia Date: Wed, 4 May 2011 03:29:06 -0700 Subject: use getters instead of member variables in velocity network filter code and add some more descriptive comments. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index feab35c..1e90d56 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2415,17 +2415,19 @@ namespace OpenSim.Region.Framework.Scenes 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 - || absoluteDistanceError > 0.25f // arbitrary distance error threshold - || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f) + if (speed < 0.01f // allow rotation updates if avatar position is unchanged + || Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold + || velocidyDiff > 0.01f) // did velocity change from last update? { m_perfMonMS = currentTick; - lastVelocitySentToAllClients = m_velocity; + lastVelocitySentToAllClients = Velocity; lastTerseUpdateToAllClientsTick = currentTick; - lastPositionSentToAllClients = m_pos; + lastPositionSentToAllClients = OffsetPosition; m_scene.ForEachClient(SendTerseUpdateToClient); -- cgit v1.1