Stoping the animation

So i’m trying to do some really basic animatior script. I got this simple script but the problem is that the animation of moving forward is starting only after animation idle stops.
My question is how can I stop the animation when a bool is set on true.
Thank you!

        if (Input.GetKeyDown("w")){
            anim.SetBool("move_forward",true);
            anim.SetBool("idle",false);
        }
        if(Input.GetKeyUp("w")){
            anim.SetBool("move_forward",false);
            anim.SetBool("idle",true);
        }

we’re going to need to see how you have setup your animator fsm

Here are some photos hope it helps

2369703--160924--Screen Shot 2015-11-05 at 12.13.33 PM.jpg
2369703--160925--Screen Shot 2015-11-05 at 12.13.29 PM.jpg
2369703--160926--Screen Shot 2015-11-05 at 12.13.26 PM.jpg

you’re question is “idle ↔ moving”, and you’ve provided screenshots for “idle → jump” and “moving ↔ jump” …

first thing I noticed, you don’t need the two bools in the transition from idle to jump, you really just need the “jump” bool, the fact you are coming from “idle state” should suffice without specifically checking that bool (i.e. trust your fsm structure rather than using redundant checks).

next thing I notice is that in the “jump ↔ moving” transitions the blend starts after a period of time, if you have done the same thing in the “idle ↔ moving” transition and you want it to immediately change to the new animation that blend (the diagonal bit) should start at time 00:00, i.e. immediately as the bool is set.

1 Like

@OP: Turn off exit time on all of the transitions that you want to happen instantly. Exit time is on by default (Not the best design choice, there).

1 Like

thank you. It works now