Key input to rotate object

I’m trying to get an object to rotate a full 360 degrees with a single key stroke. but i’m not sure how to get it to work.

I’ve got the basic key input for the keystroke. but I’m unsure about the actual rotation of the transformed object

You can use something like this:

if(Input.GetButton("ButtonToRotate")){
    objectYouWantoToRotate.transform.localEulerAngles.x += 10 * Time.deltaTime;
}

I did’n test this code.

Change localEulerAngles to eulerAngles if you need a Global Rotation.

Change the “x” to whatever axis you want.

You can chage the “Input.getButton” to “Input.getAxis(String:axis)” or “Input.GetKey(Keycode:key)”

http://unity3d.com/support/documentation/ScriptReference/Transform.RotateAround.html

if(Input.GetButton("Jump"))
{
    objecttorotate.transform.RotateAround(Vector3(0,1,0),360);
}