using UnityEngine;
using System.Collections;

public static class Math2D
{
    public static float AngleBetweenPoints(Vector2 position, Vector2 point)
    {
        var localPoint = point - position;
        return Mathf.Atan2(localPoint.y, localPoint.x) * Mathf.Rad2Deg;
    }

    public static Quaternion AngleToRotation(float angle)
    {
        return Quaternion.Euler(0, 0, angle);
    }

    public static float Angle(Vector2 vector)
    {
        return Mathf.Atan2(vector.y, vector.x) * Mathf.Rad2Deg;
    }

    public static Quaternion LookRotation(Vector3 point)
    {
        return AngleToRotation(Mathf.Atan2(point.y, point.x) * Mathf.Rad2Deg);
    }
}