Hello guys, I’m having troubles… With the script I have so far, when the unit reaches its designated position, it still keeps rotation itself standstill…
This is the code:
if (target != this.transform.position)
{
// find the vector pointing from our poisiton to the target
directionToMove = (target - this.transform.position).normalized;
// create the rotation we need to be in to look at the target
lookRotation = Quaternion.LookRotation(directionToMove);
// rotate us over time
this.transform.rotation = Quaternion.Slerp(this.transform.rotation, lookRotation, Time.deltaTime * rotationSpeed);
this.transform.position += this.transform.forward * moveSpeed * Time.deltaTime;
isMoving = true;
}