From 403a338febba8a92ce9f40094c56431ae6bcc4e2 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 21 Jun 2026 13:54:29 +0200 Subject: [PATCH] =?UTF-8?q?fix(physics=20#145):=20Slice=207=20=E2=80=94=20?= =?UTF-8?q?idle=20the=20motion=20interpreter=20on=20teleport=20arrival?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SetPosition zeros the body velocity but the motion interpreter kept the PRE-teleport ForwardCommand (RunForward), so the next Update() rebuilt that run vector via get_state_velocity and the player sprinted off in the old direction on arrival. DoMotion(Ready) makes the player arrive at rest. Not a cascade fix anymore (Slice 3 closed that) — the last user-visible bit of #145. All suites green: Core 1529 / App 480 / UI 425 / Net 313. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/AcDream.App/Input/PlayerMovementController.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/AcDream.App/Input/PlayerMovementController.cs b/src/AcDream.App/Input/PlayerMovementController.cs index 03114d63..b6923fb9 100644 --- a/src/AcDream.App/Input/PlayerMovementController.cs +++ b/src/AcDream.App/Input/PlayerMovementController.cs @@ -816,6 +816,14 @@ public sealed class PlayerMovementController _body.TransientState = TransientStateFlags.Contact | TransientStateFlags.OnWalkable; _body.Velocity = Vector3.Zero; + // #145 Slice 7: idle the motion interpreter on a server snap / teleport arrival. + // SetPosition zeros the body velocity, but the motion interpreter still holds the + // PRE-teleport ForwardCommand (e.g. RunForward), so the next Update() would + // reconstruct that run vector via get_state_velocity and the player would sprint + // off in the old direction the instant input resumes. Resetting the forward + // command to Ready makes the player arrive at rest. + _motion.DoMotion(MotionCommand.Ready, 1.0f); + // Reset physics clock so any subsequent update_object calls start fresh. _body.LastUpdateTime = 0.0; _physicsAccum = 0f;