- Home /
make my jump anim complete before walk anim starts?
I basically want it so when I press space while holding w my jump animation plays fully then when its complete change back to walk animation, right now it starts the jump animation and then switches back to walk animation :( I'm a noob in need of assistance.
Here's the code I'm using:`enter code here:(FYI it's a javascript)
function Update(){
if(Input.GetKey("w")){
animation.CrossFade("walkanim2");
}
if(Input.GetKeyUp("w"))
{
animation.CrossFade("animstop");
}
//sidewalk 2
if(Input.GetKey("d")){
animation.CrossFade("sidewalkleft");
}
//animation stop
if(Input.GetKeyUp("d"))
{
animation.CrossFade("animstop");
}
//sidewalk 1
if(Input.GetKey("a")){
animation.CrossFade("sidewalk");
}
//animation stop
if(Input.GetKeyUp("a"))
{
animation.CrossFade("animstop");
}
//jumping animation
if(Input.GetKey("space"))
animation.CrossFade("jump");
}
Answer by Tony_T · Nov 14, 2014 at 03:55 PM
You can use if (!controller.isGrounded)
to check if your player is not touching the ground.
Answer by cregox · Nov 14, 2014 at 04:02 PM
The computer is dumb and stupid. Unity is a tool that helps simplifying a few processes, but when it comes to scripting, you gotta tell the computer every little thing.
To me it sounds like your question is way too complex to be answered here. Grab a tutorial or a sample and study them. The asset store has many resources for this: https://www.assetstore.unity3d.com/en/#!/category/98/page/1/sortby/popularity