- Home /
Mecanim animator layers
I have 2 layers, the first layer is for all the basic movement animations (walk, run, jump, idle) and the second overrides the upperbody for things like blocking and hand gestures. My problem is: im trying to do blocking, i have 2 animations. the first is block start and the second is block idle. They are transitioned on a bool "blocking".
if (Input.GetMouseButton (1)) {
if (!blocking) {
blocking = true;
animator.SetLayerWeight (1, 1);
animator.SetBool ("blocking", true);
}
} else if (!Input.GetMouseButton (1)) {
if (blocking) {
blocking = false;
animator.SetBool ("blocking", false);
animator.SetLayerWeight (1, 0);
}
}
The first time i hold the block button the "block start" animation is fired and transitions to the "block idle", then it loops until i release the button. The problem is when i press the block button after, it starts off at the "block idle". I want it to start off with "block start" again.
Your answer
Follow this Question
Related Questions
What is the proper way to wait for an Animator Controller to update? 1 Answer
Clone character with new character's animator playing at the same transition position 0 Answers
Delay and Twitching when using an empty state as Transition between multiple other states 0 Answers
Check If Animator Animation Has Finished 1 Answer
What are those white curves in the animation transition panel - And can I read it in script? 0 Answers