From fca0f7c112c92e6e944adc589d12383b03dcaaa5 Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 19 Apr 2026 10:47:07 +0200 Subject: [PATCH] fix(anim): clear dead-reckon state on entity respawn MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the server re-sends CreateObject for the same guid (visibility refresh, appearance update, landblock crossing) we already drop the old WorldEntity + animated entry + physics registration. Now also clear the dead-reckon + last-move dicts keyed by the server guid so the next UpdatePosition doesn't see leftover SnapResidual or LastServerPos from the previous incarnation — which would make the first position update look like a soft-snap transition. Small fix, no new tests. 659 tests green. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/AcDream.App/Rendering/GameWindow.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/AcDream.App/Rendering/GameWindow.cs b/src/AcDream.App/Rendering/GameWindow.cs index 1dadda6..656ff93 100644 --- a/src/AcDream.App/Rendering/GameWindow.cs +++ b/src/AcDream.App/Rendering/GameWindow.cs @@ -899,6 +899,12 @@ public sealed class GameWindow : IDisposable _animatedEntities.Remove(existingEntity.Id); // Physics collision registry entry is keyed by local id too. _physicsEngine.ShadowObjects.Deregister(existingEntity.Id); + // Dead-reckon state is keyed by SERVER guid (not local id) so we + // clear using the same guid the new spawn will use. Leaving old + // SnapResidual / DeadReckonedPos in would make the next first + // UpdatePosition look like a 2m-residual soft-snap. + _remoteDeadReckon.Remove(spawn.Guid); + _remoteLastMove.Remove(spawn.Guid); } // Log every spawn that arrives so we can inventory what the server