# rotating object

i need a script to see how i can rotate an object only using the arrow keys....i have the mouse moving the object up and down side to side but i need to know how to actually rotate the object with the arrow keys..PLEASE HELP!!!!! thank you

``````if(Input.GetKey(KeyCode.UpArrow))
{

transform.Rotate(1,0,0);

}

``````
``````           function FixedUpdate ()
{
}

// Spins the rigidbody around the global y-axis
function FixedUpdate ()
{
}

``````

Another way to do it without relying on frame rate.

I'm just going to make the assumption you're using JavaScript and that you're working with the transform, and that you want to rotate around the X and Y axis, since you haven't specified.

``````var rotation : float = 360.0f;  // The amount of rotation you'd like done in rotationTime.
var rotationTime : float = 1.0f / 2.0f; // You can alter the right side operand to change the time, currently it's at 2 seconds.

function Update()
{
var verticalAxis : float   = Input.GetAxis("Vertical");
var horizontalAxis : float = Input.GetAxis("Horizontal");

var xAxisRotation : float = rotation * verticalAxis * Time.deltaTime * rotationTime;
var yAxisRotation : float = rotation * -horizontalAxis * Time.deltaTime * rotationTime;

transform.Rotate(xAxisRotation, yAxisRotation, 0.0f, Space.Self);

// You may want to play around with the space in which you're rotating the axes,
// till you find the result you're looking for.

// For instance, you could replace the rotate above with these, and look at the difference.
transform.Rotate(xAxisRotation, 0.0f, 0.0f, Space.Self);
transform.Rotate(0.0f, yAxisRotation, 0.0f, Space.World);

// Or
transform.Rotate(xAxisRotation, yAxisRotation, 0.0f, Space.World);
}

``````