BulletSim: reduce jitter in avatar velocity when walking or flying.

OpenSimulator is VERY sensitive to changes in avatar velocity and
will send an avatar update message when velocity changes more than
0.001m/s. This significantly reduces the number of avatar update messages by
smoothing the avatar velocity returned by Bullet.
user_profiles
Robert Adams 2013-01-18 11:39:24 -08:00
parent 482c7b5368
commit c6b6c94ccb
2 changed files with 9 additions and 2 deletions

View File

@ -853,7 +853,14 @@ public sealed class BSCharacter : BSPhysObject
{ {
_position = entprop.Position; _position = entprop.Position;
_orientation = entprop.Rotation; _orientation = entprop.Rotation;
// Smooth velocity. OpenSimulator is very sensitive to changes in velocity of the avatar
// and will send agent updates to the clients if velocity changes by more than
// 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many
// extra updates.
if (!entprop.Velocity.ApproxEquals(_velocity, 0.1f))
_velocity = entprop.Velocity; _velocity = entprop.Velocity;
_acceleration = entprop.Acceleration; _acceleration = entprop.Acceleration;
_rotationalVelocity = entprop.RotationalVelocity; _rotationalVelocity = entprop.RotationalVelocity;