Currently the zombies were just disappearing after their was depleted, so I wanted to add a death animation to play before they eventually vanished. Mixamo had a couple of good animations, so I downloaded one and added it to my project. The first thing I had to was to create a condition for the animation to play. This was done by creating a Boolean variable in the AI Character blueprint, which set true after the zombie health reached zero.
The next step is to add a new animation state to the zombie animation blueprint. The death animation will need to transition from both the idle and run/walk animations, but for obvious reasons not back again.
Now a link to the IsDead variable is needed in the animation blueprint. This is achieved by casting to the AI character from the event graph and getting a reference to the variable, this is then used to set a new variable, also called IsDead, in the animation blueprint.
The final step is to set up the transition links from idle and walk/run. This simply tells the game to play the animation when the condition becomes true.
If you remember,I said there was more than one death animation to choose from, but how could I pay a random animation? My first though was to use a random integer from inside the Die state, except you are unable to access the branch node. I found the solution on the Unreal Engine forums, I need to use a node called Random Sequence Player. This node allows you to create an array of animations, one of which will play at random when the transition is called.
No comments:
Post a Comment