adjust avatar terse update packet filter distance error threshold based on avatar speed

bulletsim
dahlia 2011-05-06 16:56:54 -07:00
parent b140aef87a
commit eaa33cf478
1 changed files with 5 additions and 1 deletions

View File

@ -2430,8 +2430,12 @@ namespace OpenSim.Region.Framework.Scenes
float speed = Velocity.Length(); float speed = Velocity.Length();
float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity); float velocidyDiff = Vector3.Distance(lastVelocitySentToAllClients, Velocity);
// assuming 5 ms. worst case precision for timer, use 2x that
// for distance error threshold
float distanceErrorThreshold = speed * 0.01f;
if (speed < 0.01f // allow rotation updates if avatar position is unchanged if (speed < 0.01f // allow rotation updates if avatar position is unchanged
|| Math.Abs(distanceError) > 0.25f // arbitrary distance error threshold || Math.Abs(distanceError) > distanceErrorThreshold
|| velocidyDiff > 0.01f) // did velocity change from last update? || velocidyDiff > 0.01f) // did velocity change from last update?
{ {
m_perfMonMS = currentTick; m_perfMonMS = currentTick;