MP: FIX peer gliding-stops -- snap the residual offset when legs are at rest (task #50)

User-reported 'gliding stops': when the master halts, the peer's legs wind down
to standing but the error-absorption kept sliding the body forward to close a
small residual offset -- visible precisely because no leg motion masks it.  With
the feet planted a sub-unit correction is imperceptible, so resolve it in one
frame (k=1) when replLegAdv~0 and the offset is small, instead of gliding it in.
Large offsets at rest (a real teleport) still ease.

Measured (stop-emphasis sweep): maxStep 1.77u->0.98u (now sub-unit), peer drift
2.1u->1.0u mean.  The remaining <=1u snaps are the leg-vs-body channel-shape
mismatch -- likely at/near the in-spec floor for this test rig (the Python
console relay batches packets, unlike the real dedicated pod network).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
arcattack
2026-07-14 21:51:14 -05:00
co-authored by Claude Opus 4.8
parent 38fed81d8a
commit a9ab3db952
+9
View File
@@ -2162,6 +2162,15 @@ void
const float eMag = (float)rmErr.Length();
float k = 0.15f + eMag * 0.15f; // error-proportional catch-up
if (k > 0.6f) k = 0.6f;
// AT-REST snap (user "gliding stops"): when the legs have wound down
// (replLegAdv ~0), gliding the body to absorb the residual offset is
// VISIBLE because no leg motion masks it. With the feet planted a
// sub-unit correction is invisible, so resolve it immediately instead
// of gliding it in over several frames. Only when the offset is small
// (a large offset at rest = a real teleport that should still ease).
const Logical atRest = ((replLegAdv < 0.05f && replLegAdv > -0.05f)
&& eMag < 1.0f);
if (atRest) k = 1.0f;
localOrigin.linearPosition.x += rmErr.x * k;
localOrigin.linearPosition.y += rmErr.y * k;
localOrigin.linearPosition.z += rmErr.z * k;