Rotation

hi guys,im using this script for rotation:

function Update() {

// … at the same time as spinning it relative to the global
// Y axis at the same speed.
transform.Rotate(-9, Time.deltaTime, 0, Space.Self);
}

and im still beginer in scripting,so i want this object to rotate when i start moving,or for example when i press W (move forward)…can someone tell me how to do it? tnx

hola delincuente…

i’m not sure if you are calling Input to get pressed W ?..

function Update () {
if (Input.GetKeyDown("w"){
   transform.Rotate(-9, Time.deltaTime, 0, Space.Self);
   }
}

may be?.. explain your self a bit more :wink:

greetings…

hola xD well lets try this way,i have movement script and i move on W,S,A,D,so i want this wheel for example to rotate when i hold W ,or if you know the script for animation ( to activate animation when i move :smile: )

And btw that script works but its only rotate for a bit,i want it to rotate as im holding W :smile: