// if activated, I move player towards the final position, following a path void Update() { if (activated) { if (pathIndex != patrolPath.GetPathLength()) { player.transform.rotation = Quaternion.Slerp(player.transform.rotation, transform.rotation, Time.deltaTime * 3f); Vector3 target = patrolPath.GetPositionOfPathNode(pathIndex); player.transform.position = Vector3.Lerp(player.transform.position, target, 3f * Time.deltaTime); if (Vector3.Distance(player.transform.position, target) < .1f) { pathIndex++; } } } }