- Home /
Question by
me2000 · May 24, 2015 at 02:35 PM ·
javascriptscriptingbasics
Animation stop script (very simple question)
Hi, I have a js script which is supposed to stop the animator while I hold the right mouse button and it works fine so far but the problem is that the object just stays where the animation last made it transform. Can anyone correct my script so the object moves to default position when I click the right mouse button? (sry I dont know how to attach a script so I just copy and paste it down here)
var Weapon : GameObject;
function Start () {
GetComponent("Animator").enabled = true;
}
function Update () {
if(Input.GetButton("Fire2"))
{
GetComponent("Animator").enabled = false;
}
else
{
GetComponent("Animator").enabled = true;
}
}
Comment