using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public static class TransformExtension
{
    public static void LookAt2D(this Transform trans, Vector2 targetPos)
    {
        float AngleRad = Mathf.Atan2(targetPos.y - trans.position.y, targetPos.x - trans.position.x);
        float AngleDeg = (180 / Mathf.PI) * AngleRad;
        trans.rotation = Quaternion.Euler(0, 0, AngleDeg);
    }
}
