Rotation without Movement

Hello everybody, I’m in need of help because I am starting now in the programming area. I want to do a simulation of a rotating ball, just a script that will generate the rotation without having to move. Ball will stop spinning in place when you press WASD. But there’s another script control, the ball would have to follow it with a target. How can I do? Sorry my bad English. Thank you! :stuck_out_tongue:

EDIT:

I found a script on the website of unity that is almost what I need, but the ball back to the original rotation, also is not giving 360 ° rotation how do I not go back and continue turning until you release the hand button? Thank you!

I think this is what you need. :smile:

var speed : float = 100.0;

function Update() 
{
    var horizontal : float = Input.GetAxis("Horizontal") * -speed * Time.deltaTime;
    var vertical : float = Input.GetAxis("Vertical") * speed * Time.deltaTime;
    transform.Rotate(vertical, 0, horizontal, Space.World);
}

652447–23273–$Rotate.unitypackage (3.93 KB)

It worked perfectly, thanks! :slight_smile: