Physical Address

304 North Cardinal St.
Dorchester Center, MA 02124

Simple Keypress Controls for Animation Blueprints in Unreal Engine

Before You Begin

If you don’t have a 3D model with animation assets ready to use in Unreal Engine. You can download a model with animations from the Unreal Marketplace.

I used the free Epic Games Asset, Boris. You can download him and add him to a fresh Unreal project. First, create a new Project Using the Third Person Template. Then add Boris to that project. You should have everything you need for the tutorial now.

  1. Create a animation blueprint
image
  1. Select a skeleton for the animation blueprint
image

Open the animation blueprint, in the AnimGraph, add a state machine.

image

Connect the state machine to the results node of the output Animation

image

Double Click open state machine

image

Add state for each animation you want, I created 2, walkingState and idleState

image

Double Click the state, drag in the animation to use for that state (Do this for all states)

image

Create the transitions between state

image

Open Transition Graph

image

Create Boolean Var for the state

image

Set the logic to allow the transition (in this example when IsWalking == true)

image

Now we can add the animation blueprint to a actor blueprint and modify its state machine variables with key presses

Create an actor blueprint

image

Add a Skeletal Mesh

image

Select the skeletal mesh and add the animation blueprint

image

Select the skeletal mesh and add the Mesh

image

Now if you place the actor into the scene, you should see the mesh and animation working properly.
To update the animation, add logic to the actors blueprint, reference the animation blueprint and update the variable that relates to that animation transition. (i.e. set isWalking = true)

image

Leave a Reply

Your email address will not be published. Required fields are marked *