diff options
author | dahlia | 2011-05-04 03:29:06 -0700 |
---|---|---|
committer | dahlia | 2011-05-04 03:29:06 -0700 |
commit | 4c59d57596d8c955a3634d9ffc35b4557e0b56fe (patch) | |
tree | 2ffc4b35cc7d3129738ff1e1ad21ceb238b26b89 /OpenSim/Region/Framework | |
parent | adjust terse avatar update filtering to send updates when distance traveled d... (diff) | |
download | opensim-SC-4c59d57596d8c955a3634d9ffc35b4557e0b56fe.zip opensim-SC-4c59d57596d8c955a3634d9ffc35b4557e0b56fe.tar.gz opensim-SC-4c59d57596d8c955a3634d9ffc35b4557e0b56fe.tar.bz2 opensim-SC-4c59d57596d8c955a3634d9ffc35b4557e0b56fe.tar.xz |
use getters instead of member variables in velocity network filter code and add some more descriptive comments.
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 14 |
1 files changed, 8 insertions, 6 deletions
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 | |||
2415 | 2415 | ||
2416 | Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate; | 2416 | Vector3 expectedPosition = lastPositionSentToAllClients + lastVelocitySentToAllClients * timeSinceLastUpdate; |
2417 | 2417 | ||
2418 | float absoluteDistanceError = (float)Math.Abs(Vector3.Distance(m_pos, expectedPosition)); | 2418 | float distanceError = Vector3.Distance(OffsetPosition, expectedPosition); |
2419 | 2419 | ||
2420 | float speed = Velocity.Length(); | ||
2421 | float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); | ||
2420 | 2422 | ||
2421 | if (m_velocity.Length() < 0.01f | 2423 | if (speed < 0.01f // allow rotation updates if avatar position is unchanged |
2422 | || absoluteDistanceError > 0.25f // arbitrary distance error threshold | 2424 | || Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold |
2423 | || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f) | 2425 | || velocidyDiff > 0.01f) // did velocity change from last update? |
2424 | { | 2426 | { |
2425 | m_perfMonMS = currentTick; | 2427 | m_perfMonMS = currentTick; |
2426 | lastVelocitySentToAllClients = m_velocity; | 2428 | lastVelocitySentToAllClients = Velocity; |
2427 | lastTerseUpdateToAllClientsTick = currentTick; | 2429 | lastTerseUpdateToAllClientsTick = currentTick; |
2428 | lastPositionSentToAllClients = m_pos; | 2430 | lastPositionSentToAllClients = OffsetPosition; |
2429 | 2431 | ||
2430 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2432 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2431 | 2433 | ||