How to get a object to slowly rotate to the left and then right.
I am creating an enemy that when it reaches a destination it stops, looks to the left for the player, and then to the right. I've tried the following code but the rotation is instant in both directions:
private IEnumerator LookForPlayer() { for (float f = 0; f < 30; f += Time.deltaTime) { transform.Rotate(0, f, 0); }
yield return new WaitForSeconds(0.1f);
for (float f = 0; f < 30; f += Time.deltaTime)
{
transform.Rotate(0, f, 0);
}
}
Comment
Your answer
