aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs34
1 files changed, 24 insertions, 10 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ef0eb89..e4413a9 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2340,12 +2340,14 @@ namespace OpenSim.Region.Framework.Scenes
2340 2340
2341 #region Update Client(s) 2341 #region Update Client(s)
2342 2342
2343
2343 /// <summary> 2344 /// <summary>
2344 /// Sends a location update to the client connected to this scenePresence 2345 /// Sends a location update to the client connected to this scenePresence
2345 /// </summary> 2346 /// </summary>
2346 /// <param name="remoteClient"></param> 2347 /// <param name="remoteClient"></param>
2347 public void SendTerseUpdateToClient(IClientAPI remoteClient) 2348 public void SendTerseUpdateToClient(IClientAPI remoteClient)
2348 { 2349 {
2350
2349 // If the client is inactive, it's getting its updates from another 2351 // If the client is inactive, it's getting its updates from another
2350 // server. 2352 // server.
2351 if (remoteClient.IsActive) 2353 if (remoteClient.IsActive)
@@ -2358,8 +2360,8 @@ namespace OpenSim.Region.Framework.Scenes
2358 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity); 2360 //m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
2359 2361
2360 remoteClient.SendPrimUpdate( 2362 remoteClient.SendPrimUpdate(
2361 this, 2363 this,
2362 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity 2364 PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
2363 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); 2365 | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
2364 2366
2365 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2367 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
@@ -2367,16 +2369,31 @@ namespace OpenSim.Region.Framework.Scenes
2367 } 2369 }
2368 } 2370 }
2369 2371
2372
2373 // vars to support reduced update frequency when velocity is unchanged
2374 private Vector3 lastVelocitySentToAllClients = Vector3.Zero;
2375 private int lastTerseUpdateToAllClientsTick = Util.EnvironmentTickCount();
2376
2370 /// <summary> 2377 /// <summary>
2371 /// Send a location/velocity/accelleration update to all agents in scene 2378 /// Send a location/velocity/accelleration update to all agents in scene
2372 /// </summary> 2379 /// </summary>
2373 public void SendTerseUpdateToAllClients() 2380 public void SendTerseUpdateToAllClients()
2374 { 2381 {
2375 m_perfMonMS = Util.EnvironmentTickCount(); 2382 int currentTick = Util.EnvironmentTickCount();
2376
2377 m_scene.ForEachClient(SendTerseUpdateToClient);
2378 2383
2379 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); 2384 // decrease update frequency when avatar is moving but velocity is not changing
2385 if (m_velocity.Length() < 0.01f
2386 || Vector3.Distance(lastVelocitySentToAllClients, m_velocity) > 0.01f
2387 || currentTick - lastTerseUpdateToAllClientsTick > 1500)
2388 {
2389 m_perfMonMS = currentTick;
2390 lastVelocitySentToAllClients = m_velocity;
2391 lastTerseUpdateToAllClientsTick = currentTick;
2392
2393 m_scene.ForEachClient(SendTerseUpdateToClient);
2394
2395 m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
2396 }
2380 } 2397 }
2381 2398
2382 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs) 2399 public void SendCoarseLocations(List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
@@ -3268,10 +3285,7 @@ namespace OpenSim.Region.Framework.Scenes
3268 3285
3269 m_updateflag = true; 3286 m_updateflag = true;
3270 3287
3271 // The magic constant 0.95f seems to make walking feel less jerky, 3288 Velocity = force;
3272 // probably because it hackishly accounts for the overall latency of
3273 // these Velocity updates -- Diva
3274 Velocity = force * .95F;
3275 3289
3276 m_forceToApply = null; 3290 m_forceToApply = null;
3277 } 3291 }