- Home /
 
               Question by 
               h4wkeye · May 17, 2011 at 02:17 PM · 
                javascriptgameobject  
              
 
              Question Concerning transform.Rotate
Is there any possibility to stop the transform.Rotate function after it has rotated a given amount of degrees? like
var degrees = 50;
transform.Rotate(degrees*time.DeltaTime,0,0); //ROTATE TO 50 DEGREES AND STAY THERE
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by flaviusxvii · May 17, 2011 at 02:30 PM
Something like this maybe?
var rotated = 0;
 
               function Update() { if(rotated >= 50) { return; }
  transform.Rotate(Time.DeltaTime, 0, 0);
 rotated += Time.DeltaTime;
 } 
The differences between C# and JS when it comes to something like this are superficial. Spend some time clicking back and forth between the example code in the Unity Scripting Reference to better understand how to convert them.
Your answer
 
 
             Follow this Question
Related Questions
Automatically uncheck? 1 Answer
Unity fire1 prefab in code 2 Answers
Set gameObject transperecy when fire (Javascript) 0 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                