UE4 Enemy Characters & Animations

This tutorial is the seventh in the 10 part series on how to create a first person shooter game using Unreal Engine 4. We recommend you read the previous articles first to get the maximum benefit from this tutorial.

UE4 Enemy Characters & Animations

In this tutorial I will be using animations I downloaded from mixamo. Mixamo is a website that has many different characters and animations for free download.

The Mixamo website is a great place to get free character meshes and animations

Downloading From Mixamo

Sign up for mixamo and after you made a account click the store tab and click on characters. For this tutorial I will be using the character Warzombie F Pedroso. After you have selected your character click add to my assets this will allow you to download the character later and then click look for animations this will do a search and only show you the animations that are compatible with you selected character.

Zombie hcaracter available on Mixamo

Chose the animations that you want. For this tutorial I will be using the animations Zombie Idle, Zombie Walk, Zombie Run, Zombie Attack and Zombie Dying. Once you pick the animations make sure to click the add to assets option so you are able to download it later.





Once you have added all the animations you want you go to the my assets tab. It should bring you to the my character sub-tab select your character and click queue download a menu should pop up you the format to be FBX and the pose to be T-Pose and click queue download againThen go to the my animations sub-tab and select all your animations for that character and click queue download another menu should pop up format  FBX, With skin, 60 frames per second and keyframe reduction set to none. Then click downloads and download all your animations.


A selection of animations ready to be downloaded from the Mixamo website


Import The Character To UE4

Open unreal engine pick your project. Then right click on the content browser and make a new folder I will call mine Zombie. While in the folder click import and find your character FBX file or drag and drop it in. A pop up menu should appear you shouldn't have to change anything  for importing the character so just click import all.



UE4 FBX Import Options


Import The Animations To UE4

Next drag all the animations into a folder on your desktop and import them to Unreal Engine.

Select the animations to be imported

But this time when the menu pops up you should untick import mesh and click the drop down for skeleton and select your character's skeleton then click import all.


Select the relevant import options
Then you can delete the take 1 animations as they are unnecessary. After you have deleted those your unreal folder should look like the image below. 

UE4 files


The Animation Blueprint

Next we are going to make an animation blueprint. Go the Zombie folder and right click go to animation then click animation blueprint.

Create an Animation Blueprint

Then a menu should pop up there you chose the skeleton that you want the animation blueprint to work with and then click ok then name it ZombieAnimations

Select the skeleton to use with the animation blueprint

Then create and open a new Third Person project. We will use the Third Person Animation settings from here as a base template for our Enemy Character. 

Inside the third person template then open the animations folder which is in the mannequin folder. Once there double click the ThirdPerson_AnimBP.


Open the ThirdPerson_AnimBP

Open the event graph highlight all the code and copy it by pressing ctrl c and pasting it back into our ZombieAnimations event graph by pressing ctrl v.

Copy the event graph code from the ThirdPerson_AnimBP

Next, back into our ZombieAnimations event graphwe need to make the variables for this code  so go to the variables section make a new variable call it IsInAir? leave it as a boolean variable.

Create the same variables from the ThirdPerson_AnimBP in our zombieanimation blueprint

Then make another variable call it Speed and set it as a float.

The AnimGraph

Next double click on the AnimGraph from the ThirdPerson_AnimBP and highlight the object called default and copy it and paste it into the AnimGraph of zombie animations and connect it to Final animation pose.



Next double click on default and delete everything so that all is left is idle/run and entry




Animation Blend Space

Now delete the Thirdperson_IdleRun2D then minimize ZombieAnimations and right click back in the zombie folder and hover over animation and click Blend space 1D. After you click it a menu should pop up and ask you which skeleton would you like to use just chose your characters skeleton again. Name this Blend space 1D Idle_Walk_Run.


Then open the blend space 1D and click the option to display the editor vertically and all the animations compatible with your skeleton should appear on the right. Then change the X Axis label to Speed and change the range to 0 to 375.



Also for character animations you should open each animation that you are using and enable root motion.



Then drag your animations over from the right onto the graph in the middle. Place the idle animation at the bottom, the running animation at the top and the walking animation at around 80.


Now open ZombieAnimations again and right click and search for play blendspace player Idle_Walk_Run and connect it in between Speed and Final animation pose. Then hit compile and save and we will use this in the next tutorial. 

Connect up the blendspace node between speed and Final Animation Pose

Next Up

Now that the enemy character is set up it is time to get it to chase and attack the player by programming the Enemy AI for the game.



UE4 Enemy Characters & Animations UE4 Enemy Characters & Animations Reviewed by Opus Web Design on February 13, 2016 Rating: 5

Free Design Stuff Ad