Fix issue with BulletSim avatar level flight jitter by commenting out RawVelocity update threshold for now in BSCharacter.UpdateProperties().

For some reason as yet unidentified (feedback?) a threshold above 0.4 here causes the RawVelocity to move between a lower and upper bound rather than remaining constant.
The RawVelocity increased until it triggered the threshold update, at which point it started to decrease until it again triggered the threshhold update.
This delta-v was enough to exceed the checks in ScenePresence.SendTerseUpdateToAllClients() and produce jittery avatar flight because of the fluctuating velocity.
With a threshold of 0.4 (or 0, as with ODE), the RawVelocity remains constant in BulletSim and so avatar flight becomes mostly smooth - remaining occasional glitches appear to be a result of errors in distance extraploation.
There are no obvious problems with commenting out the threshold.
Misterblue, if this is wrong or I've missed some subtlety here, please feel free to revert and/or correct.
The same considerations may or may not apply to object velocity updates.
bullet-2.82
Justin Clark-Casey (justincc) 2014-05-30 22:04:59 +01:00
parent 9ced61fbc2
commit a755c57b44
1 changed files with 12 additions and 1 deletions

View File

@ -744,7 +744,18 @@ public sealed class BSCharacter : BSPhysObject
// and will send agent updates to the clients if velocity changes by more than // 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 // 0.001m/s. Bullet introduces a lot of jitter in the velocity which causes many
// extra updates. // extra updates.
if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f)) //
// XXX: Contrary to the above comment, setting an update threshold here above 0.4 actually introduces jitter to
// avatar movement rather than removes it. The larger the threshold, the bigger the jitter.
// This is most noticeable in level flight and can be seen with
// the "show updates" option in a viewer. With an update threshold, the RawVelocity cycles between a lower
// bound and an upper bound, where the difference between the two is enough to trigger a large delta v update
// and subsequently trigger an update in ScenePresence.SendTerseUpdateToAllClients(). The cause of this cycle (feedback?)
// has not yet been identified.
//
// If there is a threshold below 0.4 or no threshold check at all (as in ODE), then RawVelocity stays constant and extra
// updates are not triggered in ScenePresence.SendTerseUpdateToAllClients().
// if (!entprop.Velocity.ApproxEquals(RawVelocity, 0.1f))
RawVelocity = entprop.Velocity; RawVelocity = entprop.Velocity;
_acceleration = entprop.Acceleration; _acceleration = entprop.Acceleration;