rotate untill the rotation is xx degrees

Hi,

i know this has been asked before but unable to find it,

would like to slowly rotate an object until it’s rotated 90 degrees or a certain amount of degrees

here’s the current piece of code

transform.Rotate(-Vector3.right * Time.deltaTime*rotationSpeed);

use transform.eulerAngles do an if check on whichever axis you want to limit, and only perform the .Rotate() function if the rotation needs to be done. alternatively you could look at using Quaternion Lerp, that would give you the ability to ease in an out of the animation if you wanted that additional feature.