From 7b0016d508dae29f2816639484ba11321c71e569 Mon Sep 17 00:00:00 2001 From: Hondacrx Date: Tue, 16 Dec 2025 14:01:15 -0500 Subject: [PATCH] Core/Entities: Fixed relative position calculation formula in Position::GetPositionOffsetTo Port From (https://github.com/TrinityCore/TrinityCore/commit/069449c5018f72287c20d5962ae64a42602d5d7e) --- Source/Game/Entities/Object/Position.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Game/Entities/Object/Position.cs b/Source/Game/Entities/Object/Position.cs index 6adcfa448..c27a676b4 100644 --- a/Source/Game/Entities/Object/Position.cs +++ b/Source/Game/Entities/Object/Position.cs @@ -151,8 +151,8 @@ namespace Game.Entities float dx = endPos.GetPositionX() - GetPositionX(); float dy = endPos.GetPositionY() - GetPositionY(); - retOffset.posX = (float)(dx * Math.Cos(GetOrientation()) + dy * Math.Sin(GetOrientation())); - retOffset.posY = (float)(dy * Math.Cos(GetOrientation()) - dx * Math.Sin(GetOrientation())); + retOffset.posX = (dx + dy * MathF.Tan(GetOrientation())) / (MathF.Cos(GetOrientation()) + MathF.Sin(GetOrientation()) * MathF.Tan(GetOrientation())); + retOffset.posY = (dy - dx * MathF.Tan(GetOrientation())) / (MathF.Cos(GetOrientation()) + MathF.Sin(GetOrientation()) * MathF.Tan(GetOrientation())); retOffset.posZ = endPos.GetPositionZ() - GetPositionZ(); retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation()); }