18 lines
337 B
C#
18 lines
337 B
C#
using UnityEngine;
|
|
using UnityEngine.AI;
|
|
|
|
public class RootMotion : MonoBehaviour
|
|
{
|
|
private NavMeshAgent _navMeshAgent;
|
|
|
|
private void Start()
|
|
{
|
|
_navMeshAgent = GetComponentInParent<NavMeshAgent>();
|
|
}
|
|
|
|
private void OnAnimatorMove()
|
|
{
|
|
transform.parent.position = _navMeshAgent.nextPosition;
|
|
}
|
|
}
|