- Home /
Rotation Force on a model
How would you rotate a plane? I'm trying to use rigidbody.AddTorque, but I want it to work for turning left and right.
var turnSpeed = 5.0;
  
               function FixedUpdate() { if (Input.GetButtonDown("Horizontal")){ rigidbody.AddTorque(transform.left * turnspeed); } 
Is there a way to make it work both directions? Horizontal won't work with only "transform.left"; it has to go right as well when needed.
               Comment
              
 
               
              Answer by Peter G · Dec 15, 2010 at 01:53 AM
Use horizontal as an axis.
var turnSpeed = 5.0;
function FixedUpdate() {
  rigidbody.AddTorque(transform.left * turnspeed * Input.GetAxis("Horizontal"));
  //Will multiply the result times 1 if right key is pressed all the way to -1 for left arrow based on pressure.
}
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                