From 3e663b9ac1f4359036e0ee14c4fe5d867e44457d Mon Sep 17 00:00:00 2001 From: hondacrx Date: Thu, 23 Sep 2021 22:49:16 -0400 Subject: [PATCH] Cleanups --- Source/Game/Entities/Object/Position.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Game/Entities/Object/Position.cs b/Source/Game/Entities/Object/Position.cs index a96734b86..db173d1d9 100644 --- a/Source/Game/Entities/Object/Position.cs +++ b/Source/Game/Entities/Object/Position.cs @@ -185,7 +185,7 @@ namespace Game.Entities } public float GetExactDistSq(float x, float y, float z) { - float dz = posZ - z; + float dz = z - posZ; return GetExactDist2dSq(x, y) + dz * dz; } @@ -207,8 +207,8 @@ namespace Game.Entities } public float GetExactDist2dSq(float x, float y) { - float dx = posX - x; - float dy = posY - y; + float dx = x - posX; + float dy = y - posY; return dx * dx + dy * dy; } @@ -225,9 +225,7 @@ namespace Game.Entities float dx = x - GetPositionX(); float dy = y - GetPositionY(); - float ang = (float)Math.Atan2(dy, dx); - ang = ang >= 0 ? ang : 2 * MathFunctions.PI + ang; - return ang; + return NormalizeOrientation(MathF.Atan2(dy, dx)); } public float GetAbsoluteAngle(Position pos) {