So im trying to make this camera bobbing animation, but when i stop pressing W the animation doesnt stop.
If someone could add something to the script below to make it stop when the w key is not pressed it will be awesome.
#pragma strict
var MainCamera : GameObject;
function Start()
{
MainCamera = GameObject.Find("Main Camera");
}
function Update ()
{
if(Input.GetButtonDown("w"))
{
// Plays the reload animation - stops all other animations
animation.Play("camBobbing_", PlayMode.StopAll);
}
}