NavMeshAgent face same direction as destination point

Hello, I have a NavMeshAgent NPC that walks correctly to its destination position. However, when it stops, it faces the walking direction, while I would like to have it turn to the same direction as the destination point


Is there a way to have the NPC, while walking to the destination point, also to set a destination rotation?


I tried to use LookRotation and Slerp, but the npc rotates in a unnatural way towards the rotation target

Thank you

By default, the agent will automatically rotate towards its steering target, so you won’t be able to apply a new rotation to it. Unless you set the agent’s ‘angular speed’ to 0, in which case it can apply a new rotation.

I can suggest rotating your NPC like this:

void Update()
    Vector3 dir = yourDestinationPosition.position - transform.position;
    dir.y = 0;//This allows the object to only rotate on its y axis
    Quaterniton rot = Quaternion.LookRotation(dir);
    transform.rotation = Quaternion.Lerp(transform.rotation, rot, rotationSpeed * Time.deltaTime);