Core/Entities: Fixed relative position calculation formula in Position::GetPositionOffsetTo
Port From (https://github.com/TrinityCore/TrinityCore/commit/069449c5018f72287c20d5962ae64a42602d5d7e)
This commit is contained in:
@@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user