Rotate to a set degree then stop Unity
- by N0xus
I'm trying to make an object rotate up on the Y axis 90 degrees, then stop. I've got the rotating up bit working fine, it's getting it to stop once it hits 90.
Some of the things I've tried include the following:
float i = rotateSpeed * Time.deltaTime;
while ( x != 90 )
{
transform.Rotate( i, 0, 0);
}
int x = 0;
x++;
if( x == 90 )
{
transform.Rotate( 0, 0, 0 );
}
For some reason I can't get this simple thing to work. What am I missing / not doing?