From d3ef4b7572e01b9c0bf87ab95edfbd53e796d9e2 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Fri, 24 Mar 2023 13:13:15 +1100 Subject: [PATCH] Fix static melee effect offsets (#14815) --- .../Weapons/Melee/MeleeWeaponSystem.Effects.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs index 5c423d0315..6631197f81 100644 --- a/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs +++ b/Content.Client/Weapons/Melee/MeleeWeaponSystem.Effects.cs @@ -153,10 +153,13 @@ public sealed partial class MeleeWeaponSystem _animation.Play(animationUid, GetFadeAnimation(sprite, 0.05f, 0.15f), FadeAnimationKey); break; case WeaponArcAnimation.None: - var (mapPos, mapRot) = _transform.GetWorldPositionRotation(userXform, GetEntityQuery()); - var xform = Transform(animationUid); + var xformQuery = GetEntityQuery(); + var (mapPos, mapRot) = _transform.GetWorldPositionRotation(userXform, xformQuery); + var xform = xformQuery.GetComponent(animationUid); xform.AttachToGridOrMap(); - _transform.SetWorldPosition(xform, mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos)); + var worldPos = mapPos + (mapRot - userXform.LocalRotation).RotateVec(localPos); + var newLocalPos = _transform.GetInvWorldMatrix(xform.ParentUid, xformQuery).Transform(worldPos); + _transform.SetLocalPositionNoLerp(xform, newLocalPos); if (arcComponent.Fadeout) _animation.Play(animationUid, GetFadeAnimation(sprite, 0f, 0.15f), FadeAnimationKey); break; -- 2.51.2