Looped rotation?

Hello. I want to have an object rotate to a degree locally, and then rotate to another degree that is relative to that position (so if the first rotation was 180 and the second was -100, the object would end up facing 80 degrees from its first position) and then have it repeat.

I know how to make an object rotate, but how would I do the second rotation and then how would I have the whole thing loop? Also, would there be a way to have a pause inbetween the rotations WITHOUT using yield WaitForSeconds(); (I cannot use that because I also want to have the object move forward and yield doesnt work with function Update)?


Decide how fast you want it to rotate (degrees per second) and then do the rotation in the Update method, using transform.Rotate(0, rotationSpeed * Time.deltaTime, 0). That's assuming rotation around the Y axis, which is typically the "up" direction.

Have a current targetRotation at all times, and rotate towards that target at your current rotation speed. You can change the target and speed to rotate to different positions.