- Home /
Activate and Deactivate Animations
Hi!
Basically what I want is to activate and deactivate my characters jet pack with one button press.
However, I also have a "hover" animation which needs to play after the jet pack is activated and then stop playing when the jet pack deactivates.
When I play these animations I also need to stop the "idle" animation which is playing when the character is grounded :/
Any help would be amazing as I am really stuck!
Thank you so much in advance :D
Answer by zerox911 · Mar 28, 2012 at 08:04 AM
this is my answer on how to play the animation...
var object : GameObject;
function OnGUI(){
if(GUI.Button(Rect(X,Y,x,y),"JETPACK"){
object.animation.Play("JETPACK");
}
something like this...
u could change it to other triggers like..
if(Input.GetKeyDown("Space")){
object.animation.Play("JUMP");
}
something like that..
@_@