Rotation certain number of degrees

Hello guys ,
I want to rotate a certain number of degrees (90 degrees) on a certain axis.
I have applied this :

transform.RotateAround(transform.position, transform.right, RotSpeed * Time.deltaTime * -90f);


RotSpeed is 7

but I realized that it keeps rotating so perhaps the

RotSpeed * Time.deltaTime * -90f

is just the speed of rotation and not the number of degrees to rotate.

Any other code that allows to achieve what I am looking for?


Good day,

I always recommend to use Eulerangles to define rotations, so its what you see in the Inspector as rotation. this way is very simple to use and define.

You should use this ( Here, I rotate in X axis, but you can do with any of them)

float RotationSpeed = 7;
float XRotation = Object.transform.rotation.eulerAngles.x+(RotationSpeed * Time.deltaTime);
float YRotation = Object.transform.rotation.eulerAngles.y
float ZRotation = Object.transform.rotation.eulerAngles.z

Object.transform.rotation.eulerAngles = new Vector3 (XRotation, YRotation, ZRotation);

It’s very simple and works pefect. Bye!