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;