/// <summary>
/// Get clockwise angle of a 2d vector(x y).
/// </summary>
/// <param name="x">x component</param>
/// <param name="y">y component</param>
/// <returns>Angle in degree</returns>
public static float ClockAngle(float x, float y)
{
float angle = Mathf.Atan(x / y) / Mathf.PI;
if (angle < 0) angle = 1 + angle;
if (x < 0) angle += 1;
return angle * 180;
}
/// Get clockwise angle of a 2d vector(x y).
/// </summary>
/// <param name="x">x component</param>
/// <param name="y">y component</param>
/// <returns>Angle in degree</returns>
public static float ClockAngle(float x, float y)
{
float angle = Mathf.Atan(x / y) / Mathf.PI;
if (angle < 0) angle = 1 + angle;
if (x < 0) angle += 1;
return angle * 180;
}