I want an enemy chasing the player but I wouldn’t want the enemy to be able to look at me instantaneously.
This is my code for the rotation:
Vector3 dir = player.transform.position - this.transform.position;
float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg;
transform.rotation = Quaternion.AngleAxis(angle - 90.0f, Vector3.forward);
*edit: Changed added -90.0f at the last line because the sprite was facing the target sidewards.