작성
·
402
0
void UpdateMoving()
{
Vector3 dir = _destPos - transform.position;
if (dir.magnitude < 0.0001f)
{
_state = PlayerState.Idle;
}
else
{
NavMeshAgent nma = gameObject.GetOrAddComponent<NavMeshAgent>();
float moveDist = Mathf.Clamp(_speed * Time.deltaTime, 0, dir.magnitude);
nma.Move(dir.normalized * moveDist);
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(dir), 20 * Time.deltaTime);
}
Animator anim = GetComponent<Animator>();
anim.SetFloat("speed", _speed);
}
"Move" can only be called on an active agent that has been placed on a NavMesh.
UnityEngine.AI.NavMeshAgent:Move (UnityEngine.Vector3)
PlayerController:UpdateMoving () (at Assets/Scrips/Controllers/PlayerController.cs:49)
PlayerController:Update () (at Assets/Scrips/Controllers/PlayerController.cs:72)
오류는 이렇게 뜨는데, 비주얼 문법 상에는 문제가 없다고 뜹니다 ㅠ
답변 2
0
0