This commit is contained in:
hondacrx
2021-09-23 22:49:16 -04:00
parent 4a61a40fb8
commit 3e663b9ac1
+4 -6
View File
@@ -185,7 +185,7 @@ namespace Game.Entities
} }
public float GetExactDistSq(float x, float y, float z) public float GetExactDistSq(float x, float y, float z)
{ {
float dz = posZ - z; float dz = z - posZ;
return GetExactDist2dSq(x, y) + dz * dz; return GetExactDist2dSq(x, y) + dz * dz;
} }
@@ -207,8 +207,8 @@ namespace Game.Entities
} }
public float GetExactDist2dSq(float x, float y) public float GetExactDist2dSq(float x, float y)
{ {
float dx = posX - x; float dx = x - posX;
float dy = posY - y; float dy = y - posY;
return dx * dx + dy * dy; return dx * dx + dy * dy;
} }
@@ -225,9 +225,7 @@ namespace Game.Entities
float dx = x - GetPositionX(); float dx = x - GetPositionX();
float dy = y - GetPositionY(); float dy = y - GetPositionY();
float ang = (float)Math.Atan2(dy, dx); return NormalizeOrientation(MathF.Atan2(dy, dx));
ang = ang >= 0 ? ang : 2 * MathFunctions.PI + ang;
return ang;
} }
public float GetAbsoluteAngle(Position pos) public float GetAbsoluteAngle(Position pos)
{ {