I want to have a animation play when a button is pressed down. And then have the animation reverse from the point it stopped when the button is released, how can i achive this using javascript?
Try this:
function Update () {
if (Input.GetButton ("Fire2") {
animation.Play ("FunkyThing");
}
if (Input.GetButton ("Fire1") {
animation["FunkyThing"].speed = -1.0;
}
}
Play the animation with `right-click` or `ctrl`. To reverse the animation, press `spacebar` or `left-click`.