using UnityEngine;
using ScrambleKit.Extensions;

namespace ScrambleKit.Move
{
    public class FaceTowardMovement : MonoBehaviour
    {
        private Rigidbody2D rb;

        void Start()
        {
            rb = GetComponent<Rigidbody2D>();
        }

        void FixedUpdate()
        {
            AlignFacingWithVelocity();
        }

        private void AlignFacingWithVelocity()
        {
            transform.eulerAngles = new Vector3(0, 0, rb.velocity.AngleFacing());
        }

    }
}