From a7c3be815f3849a6e1aa4a76d81da700ad8bbbca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Thu, 8 Oct 2026 05:22:19 +0300 Subject: [PATCH] Fix GetAbsVelocity returning stale abs velocity --- Game.Server/BaseEntity.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Game.Server/BaseEntity.cs b/Game.Server/BaseEntity.cs index 2e8b26209..785ed779d 100644 --- a/Game.Server/BaseEntity.cs +++ b/Game.Server/BaseEntity.cs @@ -2261,9 +2261,29 @@ public void SetBlocksLOS(bool blocksLOS) { public ref readonly Vector3 GetLocalVelocity() => ref Velocity; public ref readonly Vector3 GetAbsVelocity() { + if (IsEFlagSet(EFL.DirtyAbsVelocity)) + CalcAbsoluteVelocity(); + return ref AbsVelocity; } + public void CalcAbsoluteVelocity() { + if (!IsEFlagSet(EFL.DirtyAbsVelocity)) + return; + + RemoveEFlags(EFL.DirtyAbsVelocity); + + BaseEntity? moveParent = GetMoveParent(); + if (moveParent == null) { + AbsVelocity = Velocity; + return; + } + + MathLib.VectorRotate(Velocity, moveParent.EntityToWorldTransform(), out AbsVelocity); + + AbsVelocity += moveParent.GetAbsVelocity(); + } + public string? Classname; // prev m_iClassname public string? GlobalName; // prev m_iGlobalname public string? ParentName; // prev m_iParent