Core/Entities: Fixed relative position calculation formula in Position::GetPositionOffsetTo

Port From (https://github.com/TrinityCore/TrinityCore/commit/069449c5018f72287c20d5962ae64a42602d5d7e)
This commit is contained in:
Hondacrx
2025-12-16 14:01:15 -05:00
parent 1a6ce863af
commit 7b0016d508
+2 -2
View File
@@ -151,8 +151,8 @@ namespace Game.Entities
float dx = endPos.GetPositionX() - GetPositionX(); float dx = endPos.GetPositionX() - GetPositionX();
float dy = endPos.GetPositionY() - GetPositionY(); float dy = endPos.GetPositionY() - GetPositionY();
retOffset.posX = (float)(dx * Math.Cos(GetOrientation()) + dy * Math.Sin(GetOrientation())); retOffset.posX = (dx + dy * MathF.Tan(GetOrientation())) / (MathF.Cos(GetOrientation()) + MathF.Sin(GetOrientation()) * MathF.Tan(GetOrientation()));
retOffset.posY = (float)(dy * Math.Cos(GetOrientation()) - dx * Math.Sin(GetOrientation())); retOffset.posY = (dy - dx * MathF.Tan(GetOrientation())) / (MathF.Cos(GetOrientation()) + MathF.Sin(GetOrientation()) * MathF.Tan(GetOrientation()));
retOffset.posZ = endPos.GetPositionZ() - GetPositionZ(); retOffset.posZ = endPos.GetPositionZ() - GetPositionZ();
retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation()); retOffset.SetOrientation(endPos.GetOrientation() - GetOrientation());
} }