From a9ab3db95224f0aa19d4aecb8cb153f9cb1b089d Mon Sep 17 00:00:00 2001 From: arcattack Date: Tue, 14 Jul 2026 21:51:14 -0500 Subject: [PATCH] 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) --- game/reconstructed/mech4.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/game/reconstructed/mech4.cpp b/game/reconstructed/mech4.cpp index 72d86dc..1c004a5 100644 --- a/game/reconstructed/mech4.cpp +++ b/game/reconstructed/mech4.cpp @@ -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;