- Home /
 
transform.Rotate For an Certain Amount of Time
I have a camera that I want to rotate off of an airplane and go down to an island. I am using transform.Rotate, but I was wondering if there was a way to rotate for x amount of seconds to get to the right spot. I have already looked at many other questions, but none of them apply for my situation.
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by trs9556 · Aug 24, 2013 at 11:21 PM
You can just check to see if a specific amount of time has passed and if it has, don't rotate any more.
 public float amountOfTimeToPass = 2f; //amount of time till we STOP rotating
 private float ourTime; //you can ignore this. This var will just hold our time
 
 void Awake(){
     ourTime = Time.time + amountOfTimeToPass;
 }  
 
 void Update(){
     if(Time.time < ourTime){
         //code to rotate camera
     }
 }
 
              Your answer