diff options
author | Robert Adams | 2013-01-18 11:39:24 -0800 |
---|---|---|
committer | Robert Adams | 2013-01-18 11:39:24 -0800 |
commit | c6b6c94ccbbbd5226a377a510a988bedec7a418c (patch) | |
tree | 7abde96ff752d5e10dcbbe47ed6f6df63e75e643 | |
parent | BulletSim: add logic to turn off pre-step actions when object goes (diff) | |
download | opensim-SC-c6b6c94ccbbbd5226a377a510a988bedec7a418c.zip opensim-SC-c6b6c94ccbbbd5226a377a510a988bedec7a418c.tar.gz opensim-SC-c6b6c94ccbbbd5226a377a510a988bedec7a418c.tar.bz2 opensim-SC-c6b6c94ccbbbd5226a377a510a988bedec7a418c.tar.xz |
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.
-rw-r--r-- | OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | 9 | ||||
-rwxr-xr-x | OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | 2 |
2 files changed, 9 insertions, 2 deletions
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 6d5e23f..478aeab 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs | |||
@@ -853,7 +853,14 @@ public sealed class BSCharacter : BSPhysObject | |||
853 | { | 853 | { |
854 | _position = entprop.Position; | 854 | _position = entprop.Position; |
855 | _orientation = entprop.Rotation; | 855 | _orientation = entprop.Rotation; |
856 | _velocity = entprop.Velocity; | 856 | |
857 | // Smooth velocity. OpenSimulator is very sensitive to changes in velocity of the avatar | ||
858 | // and will send agent updates to the clients if velocity changes by more than | ||
859 | // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many | ||
860 | // extra updates. | ||
861 | if (!entprop.Velocity.ApproxEquals(_velocity, 0.1f)) | ||
862 | _velocity = entprop.Velocity; | ||
863 | |||
857 | _acceleration = entprop.Acceleration; | 864 | _acceleration = entprop.Acceleration; |
858 | _rotationalVelocity = entprop.RotationalVelocity; | 865 | _rotationalVelocity = entprop.RotationalVelocity; |
859 | 866 | ||
diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index bac0427..5353c75 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs | |||
@@ -141,7 +141,7 @@ public abstract class BSPhysObject : PhysicsActor | |||
141 | 141 | ||
142 | // It can be confusing for an actor to know if it should move or update an object | 142 | // It can be confusing for an actor to know if it should move or update an object |
143 | // depeneding on the setting of 'selected', 'physical, ... | 143 | // depeneding on the setting of 'selected', 'physical, ... |
144 | // This flag is the true test -- if true, the object is being acted on in the physical world | 144 | // This flag is the true test -- if true, the object is being acted on in the physical world |
145 | public abstract bool IsPhysicallyActive { get; } | 145 | public abstract bool IsPhysicallyActive { get; } |
146 | 146 | ||
147 | // Materialness | 147 | // Materialness |