using UnityEngine;

[DefaultExecutionOrder(1)]
public class ParentSimuator : MonoBehaviour
{
    [SerializeField] Transform _target;
    [SerializeField] Vector3 _targetPosition;

    void OnEnable()
    {
        _targetPosition = _target.InverseTransformPoint(transform.position);
    }

    void Update()
    {
        Vector3 targetPosition = _target.TransformPoint(_targetPosition);

        transform.position = targetPosition;

        _targetPosition = _target.InverseTransformPoint(transform.position);
    }
}
