Unreal Engine 4 Animation Tutorial

In this Unreal Engine 4 animation tutorial, you will learn how to import and use animations. By Tommy Tran.

4.7 (23) · 2 Reviews

Save for later
Share

You will rarely see a modern game without animation. This is because animation is key in conveying motion. Without animation, a character would just look like they’re sliding instead of running.

Luckily, Unreal makes it easy to get your characters animated in no time!

In this tutorial, you will learn how to:

  • Import a mesh with a skeleton
  • Import animations
  • Create an Animation Blueprint to transition to different animations
  • Blend between animations

Please note, you will be using Blueprints in this tutorial. If you need a refresher, check out our Blueprints tutorial.

Note: This tutorial is part of a 10-part tutorial series on Unreal Engine:

Getting Started

Download the starter project and unzip it. In the root directory, you will see a folder named Animation Assets. This folder contains the character and animations that you will be importing.

Unreal Engine 4 Animation Tutorial

Open the project by navigating to the project folder and opening SkywardMuffin.uproject.

Note: If you get a message saying that the project was created with an earlier version of the Unreal editor, that’s OK (the engine is updated frequently). You can either choose the option to open a copy, or the option to convert in place.

Press Play to start the game. The goal of the game is to touch as many clouds as possible without falling. Click the left-mouse button to jump up to the first cloud.

Unreal Engine 4 Animation Tutorial

Instead of a plain red circle, let’s control this cute little muffin instead:

Unreal Engine 4 Animation Tutorial

This muffin contains a skeleton which allows you to animate it.

Unreal Engine 4 Animation Tutorial

What is a Skeleton?

In 3D applications, a skeleton is a set of interconnected points called joints. In the image below, each sphere is a joint.

Unreal Engine 4 Animation Tutorial

Note: Unreal uses the terms joint and bone interchangeably.

By manipulating these joints, you can create different poses for your character.

Unreal Engine 4 Animation Tutorial

When you go from one pose to another, you are creating an animation.

Unreal Engine 4 Animation Tutorial

If you create more poses between the previous poses, you can get something like this:

Unreal Engine 4 Animation Tutorial

In Unreal, any mesh with a skeleton is a Skeletal Mesh. Let’s begin by importing the Skeletal Mesh for the muffin.

Importing a Skeletal Mesh

Go to the Content Browser and navigate to Characters\Muffin. Click Import and then go to SkywardMuffinStarter\Animation Assets. Select SK_Muffin.fbx and then click Open.

Unreal Engine 4 Animation Tutorial

In the import window, go to the Mesh section and uncheck the Create Physics Asset option. The Physics Asset helps create a ragdoll effect. Since this tutorial does not cover that, you do not need one.

Unreal Engine 4 Animation Tutorial

The project already includes the muffin material and texture so you don’t need to import them. Uncheck the Import Materials and Import Textures options.

Unreal Engine 4 Animation Tutorial

Leave everything else at their default settings and then click Import. This will create the following assets:

  • SK_Muffin: The Skeletal Mesh asset. This is basically just a mesh with a link to a Skeleton asset.
  • SK_Muffin_Skeleton: The Skeleton asset. This holds a list of joints and other information such as their hierarchy.
    Unreal Engine 4 Animation Tutorial

Now that you have the muffin imported, it’s time to use it.

Using a Skeletal Mesh

Before you use your new Skeletal Mesh, you should give it a material so it’s not just a grey blob. Double-click on SK_Muffin to open it.

Go to the Asset Details panel and locate the Material Slots section. Assign the M_Muffin material and then close SK_Muffin.

Unreal Engine 4 Animation Tutorial

Now, let’s use SK_Muffin as the player character. Go back to the Content Browser and double-click on BP_Muffin to open it.

Go to the Components panel and select the Mesh (Inherited) component. Navigate to the Details panel and locate the Mesh section. Set the Skeletal Mesh property to SK_Muffin.

Unreal Engine 4 Animation Tutorial

Click Compile and then go back to the main editor. Press Play to play the game as a muffin!

Unreal Engine 4 Animation Tutorial

The game is already looking a lot better! Your next step is to import some animations that will add life to the muffin.

Importing Animations

Go to the Content Browser and click Import. Make sure you are in SkywardMuffinStarter\Animation Assets. Select the following files:

  • SK_Muffin_Death.fbx
  • SK_Muffin_Fall.fbx
  • SK_Muffin_Idle.fbx
  • SK_Muffin_Jump.fbx
  • SK_Muffin_Walk.fbx

Once you have done that, click Open.

Unreal Engine 4 Animation Tutorial

In the import window, go to the Mesh section and uncheck the Import Mesh option. This will make sure the Skeletal Mesh is not imported again.

Unreal Engine 4 Animation Tutorial

Next, make sure the Skeleton property is set to SK_Muffin_Skeleton. This specifies which skeleton the animation will use.

Unreal Engine 4 Animation Tutorial

Finally, click Import All. This will import all the animations with the settings you just specified.

Unreal Engine 4 Animation Tutorial

Now that you have all your animations, you need a way to play them. You can use an Animation Blueprint to do this.

Creating an Animation Blueprint

An Animation Blueprint is like a regular Blueprint. However, it also features a graph dedicated to animation tasks.

To create one, go to the Content Browser and click the Add New button. Select Animation\Animation Blueprint.

In the pop-up window, locate the Target Skeleton property and select SK_Muffin_Skeleton. Next, click the OK button to create the Animation Blueprint.

Unreal Engine 4 Animation Tutorial

Rename the asset to ABP_Muffin. Afterwards, double-click on it to open it in the Animation Blueprint editor.

The Animation Blueprint Editor

The Animation Blueprint editor is like the Blueprint editor but with four extra panels:

Unreal Engine 4 Animation Tutorial

  1. Anim Graph: This graph is dedicated to animation. This is where you will play your animations.
  2. Preview Scene Settings: This panel allows you to tweak the preview scene in the Viewport
  3. Anim Preview Editor: Variables you create will also show up here. Use this panel to preview the effect your variables have on the final animation.
  4. Asset Browser: This panel contains a list of animations the current skeleton can use

To define when each animation should play, you can use a State Machine.

What is a State Machine?

A State Machine is a set of states and rules. For the purposes of this tutorial, you can think of a state as an animation.

State Machines can only be in one state at a time. To transition to a different state, certain conditions—defined by rules—must be met.

Below is an example of a simple State Machine. It shows the states of a jump and the rules for transitioning to each state.

Unreal Engine 4 Animation Tutorial

States can also have a two-way relationship. In the example below, the Jump and Fall states can transition to each other.

Unreal Engine 4 Animation Tutorial

Without this two-way relationship, a character wouldn’t be able to perform a double jump. This is because the character would only be able to enter the Jump state from the Idle state.

That’s enough about State Machines. Let’s go ahead and create a new State Machine.