- Home /
How to add attack animation to the movement blend tree?
Hi! I'm using standard character assets from unity, and there is this 3rd person controller prefab that comes with a bunch of animations, i.e. jump, crouch, and movement. I want to add an attack animation to the movement blend tree (2D Freeform Cartesian), so the character can attack at any stage of moving(idle, walking or running). Is it possible? I can imagine i would have to do something like a 2 dimentional array (every of the 15 stages can blend into attack animation, so 15x2 array?) for this, but there is no such thing in unity animation blend trees I guess :) Please help. Jacob
Answer by beppim · Jun 16, 2016 at 11:33 AM
From the Animator Window you should be able to see the Animator Controller attached to the object and add your own Animation, and then manage all the transitions from one animation to the other clicking on the lines, and of course the animation graph.... Link your animation to "Any State" and then trigger it by code.
Sorry I cannot be more specific (I don't have Unity right now here) but I think it should be a rather straight forward action if I understood well..
Hi! I have done something like this I guess already, but there is no blending, the transition is instant and it looks ugly. Is it possible that for example for running animation in the blend tree to blend into attack animation so the transition is smooth, not instant?
I have also tried layer masks and applied the attack animation to the upper body, but is looks hilarious, with the waving hands and legs staying still on the ground :D I also dont know how to play and attack animation only once (when i click attack button) when the animation is no in the default/main layer: i use Play("name of animation", layer); but it doesnt work.
When i set the weight of the animation layer where the attack animaton is to 1, the character is constantly playing that attack animation, and i dont want that.
I m not sure I have expressed myself clear enough for you to understand though :)