I’ve been using the “Third Person MMO Character Controller” Asset from the Unity Asset store, and it comes with a third person character and controller. I’d like to add an attack animation to the character that plays every time the player clicks, but I can’t seem to figure it out. The character already comes with animations such as walk, run, jump, etc, and they seem to override/mess up any animation I do add. Add suggestions?
- make the animation
- make animation controller
- make the script animation
I suppose you want to attack only with your upper body, right? In that case, you need an avatar mask that only enables the upper part of the body. You then make a new layer in your animator, with the mask set as your upper body mask.
On this new layer, you add a default state with a transition to your attack state. The condition to go to attack can be a trigger, and the condition to leave the attack state could be exit time (if you want the player to click every time he wants to perform an attack).
More on avatar masks here.
Also, the classic mecanim tutorial has an example of body masks.
EDIT: Don’t forget to set the weight for the new layer, a value of 1 should be ok. Also, I think blend mode should be set to “Override” on the new layer. More info on layers here.