Rotate on button press
![TangoDownStudios](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
I would like to add rotational velocity to an object when I press a button. Seems simple enough right? But the caveat is I want it to be smooth and constant as long as the button is held down.
When the left button is pressed for instance I want an object to rotate to the left and continue rotating at a fixed speed until the left button is depressed.
I've tried to add rotational velocity (self.motion.angularvelocity=self.motion.angularvelocity+5.0) but it only does it once, then I have to press the button down again. Is there any way of continuously applying this?
When the left button is pressed for instance I want an object to rotate to the left and continue rotating at a fixed speed until the left button is depressed.
I've tried to add rotational velocity (self.motion.angularvelocity=self.motion.angularvelocity+5.0) but it only does it once, then I have to press the button down again. Is there any way of continuously applying this?
Comments
Try both out and see what works for you
cheers
Hope I can find an answer before someone else posts it here (Would be greatly appreciated though)
And major props to JohnPapiomititis for his grand help!
When I set a timer with an interval of 0.2 to increment the rotationalVelocity value I get a very undesired slow moving effect and the rotationalVelocity does not increment correctly. Say I increment +5 to the rotationalVelocity: the object will start rotating at 0.2 velocity and go back to 0, then 0.2 seconds later will start rotating at 0.2 velocity again and this will continue until I depress the key
Instead of having when attribute rotate =0 constrain attribute angular velocity to 0, have this:
Have a rule When attribute rotate = 0
in that rule interpolate self angular velocity to 0, with ease out selected
then another rule seperate from that one when attribute rotate =0 AND attribute self angular velocity =0 constrain self angular velocity to 0
Leave all the rules to start and interpole the rotation when rotate = 1 the same, that should do it for ya
theres the fixed project for ya
cheers
Thanks for all your help!