using System;
using UnityEngine;

namespace NBF
{
    public class FixedLine : MonoBehaviour
    {
        public Transform target;
        private Rigidbody _rigidbody;

        private void Awake()
        {
            _rigidbody = GetComponent<Rigidbody>();
        }

        private void LateUpdate()
        {
            FixLine();
        }

        private void FixedUpdate()
        {
            FixLine();
        }

        private void FixLine()
        {
            if (!target) return;
            _rigidbody.MovePosition(target.position);
        }
    }
}