Ejemplo n.º 1
0
    public static Vector2 ClosestCardinalOrOrdinalDirection(this Vector2 vector)
    {
        Vector2 closestCardinal = vector.ClosestCardinalDirection();
        Vector2 closestOrdinal  = SuperMath.ZeroSign(vector);

        if (Vector2.Angle(vector, closestCardinal) < Vector2.Angle(vector, closestOrdinal))
        {
            return(closestCardinal);
        }
        else
        {
            return(closestOrdinal);
        }
    }