Support Forum

Force agent to keep rotating to look directly at his target even if target reached?

How to force agent to keep rotating to look directly at his target even if target reached?
Right now he stops and does not finish his rotation to the final end point

Hi,

I am having the same problem, did you find any solution to this issue?

Kinda yes, I extend from AIPath and then in Update:

var direction = (target.position - transform.position).normalized;
Quaternion lookRotation = Quaternion.LookRotation(new Vector3(direction.x, 0, direction.z));
transform.rotation = Quaternion.Slerp(transform.rotation, lookRotation, Time.deltaTime * 5);
1 Like

Thanks! I think this solves my problem for now :slight_smile: