So I followed the beginner navigation tutorials here on the site for NavMesh’s and the baking and movements for my character and plan to also use it for my AI. But I am having one problem. I can’t get my character to rotate to face the direction he is walking. I tried using the agent updateRotation but it keeps coming up with errors. How am I wrong in my assumption that the following should work?
private var agent: NavMeshAgent;
function Start () {
agent = GetComponent.<NavMeshAgent>();
}
function Update () {
var hit: RaycastHit;
// When the mouse is clicked...
if (Input.GetMouseButtonDown(0)) {
// If the click was on an object then set the agent's
// destination to the point where the click occurred.
var ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, hit)) {
agent.SetDestination(hit.point);
agent.updateRotation;
}
}
}