Reader small image

You're reading from  Blueprints Visual Scripting for Unreal Engine 5 - Third Edition

Product typeBook
Published inMay 2022
Reading LevelBeginner
PublisherPackt
ISBN-139781801811583
Edition3rd Edition
Languages
Tools
Right arrow
Authors (2):
Marcos Romero
Marcos Romero
author image
Marcos Romero

Marcos Romero is the author of the Romero Blueprints blog, which is one of the main references on the internet to learn about Blueprints. Epic Games invited Marcos to the Unreal Engine 4 closed beta program to experiment and collaborate with the evolution of the tools. He was also one of the first recipients of Unreal Dev Grants for Education. Marcos is a well-known figure in the Unreal community and, for Epic Games, he wrote the official Blueprints Compendium and Blueprints Instructor's Guide.
Read more about Marcos Romero

Brenden Sewell
Brenden Sewell
author image
Brenden Sewell

Brenden Sewell is a game designer and creative director with over a decade of experience leading teams in the development of compelling interactive experiences that entertain and inspire. Prior to joining Bossfight Entertainment to work on some upcoming secret projects, he explored the intersection of social impact and entertainment serving as the Creative Director for E-line Media. He has led developments from concept to live support on a variety of games ranging from a brain-training first-person shooter to a construction sandbox exploring the future of digital fabrication.
Read more about Brenden Sewell

View More author details
Right arrow

Chapter 17: Animation Blueprints

Part 4 presented data structures, flow control, math nodes, Blueprints tips, and an introduction to virtual reality development.

In Part 5, we will look at Animation Blueprints, Blueprint libraries and components, procedural generation, and the Product Configurator template.

This chapter presents the main elements of the Unreal Engine animation system, such as Skeleton, Skeletal Mesh, Animation Sequences, and Blend Spaces. It shows how to script an Animation Blueprint using EventGraph and AnimGraph. It also explains how State Machines are used in an animation and how to create new states for an animation.

These are the topics covered in this chapter:

  • Animation overview
  • Creating Animation Blueprints
  • Exploring State Machines
  • Importing the Animation Starter Pack
  • Adding Animation States

By the end of the chapter, you will know how to use Animation Blueprints and how to add Animation States.

Animation overview

The animation system in Unreal Engine is very flexible and powerful. It consists of numerous tools and editors that work together. In this chapter, we will look at the main concepts of animation in Unreal Engine with a focus on Animation Blueprints.

We will start with a project using the Third Person template to see animation concepts and explore the Animation Editor.

Follow these steps to create the project:

  1. Create a project using the Third Person template with starter content:

Figure 17.1 – Creating a project using the Third Person template

  1. Press the Play button to try the default gameplay that is built into the Third Person template. You can move the player Character using the WASD keys and look around by moving the mouse. Press the spacebar to make the Character jump.

Now that we have an example project, let's explore the Animation Editor.

Animation Editor

There are five Animation Tools...

Creating Animation Blueprints

An Animation Blueprint is a specialized Blueprint with tools geared toward Character animation scripting. The Animation Blueprint Editor is like the Blueprint Editor, but it has some specific panels for animation.

Follow these steps to create an Animation Blueprint:

  1. Click the ADD button in the Content Browser, and in the Animation submenu, select Animation Blueprint, as shown in the following screenshot:

Figure 17.7 – Creating an Animation Blueprint

  1. In the next window, you need to select the target Skeleton. The animation assets and the Animation Blueprint are linked to a specific Skeleton. Optionally, you can select a different parent class instead of the default class. For this example, do not select a parent class and select UE4_Mannequin_Skeleton, which is in the /Game/Mannequin/Character/ path:

Figure 17.8 – Selecting the target Skeleton

  1. Give a name to the...

Exploring State Machines

A State Machine in the AnimGraph allows you to organize the animation into a series of states. To exemplify this, we will create a State Machine with two states: idle and moving.

We need to define Transition Rules to control the transition from one state to another.

Follow these steps to create the State Machine:

  1. Remove the other animation nodes and leave only the Output Pose node in the AnimGraph.
  2. Right-click on the AnimGraph, search for state machine, and select Add New State Machine…:

Figure 17.18 – Adding a State Machine

  1. Rename the State Machine to Char States. You can rename it in the Details panel. Connect the white icon of the State Machine to the white icon of the Output Pose node:

Figure 17.19 – Connecting the State Machine to the Output Pose node

  1. Double-click on the Char States node to edit the State Machine. Then, right-click on the graph and...

Importing the Animation Starter Pack

In the next sections, we will use the Animation Starter Pack because it has more animations available.

Follow these steps to import the Animation Starter Pack:

  1. Access the Epic Games Launcher and go to Unreal Engine | Library | Vault. Search for Animation Starter Pack and click the Add To Project button:

Figure 17.27 – Adding the Animation Starter Pack to a project

Note

If you don't have the Animation Starter Pack installed, follow the instructions in Chapter 9, Building Smart Enemies with Artificial Intelligence, to install it.

  1. Select the project you created for this chapter. A folder called AnimStarterPack will be added to the Content folder of your project.
  2. Look in the Viewport of the Level Editor and delete the ThirdPersonCharacter instance that is in the Level. We will use the Character of the Animation Starter Pack.
  3. Open the ThirdPersonGameMode Blueprint located in the...

Adding Animation States

In this section, we will modify the Character Blueprint and Animation Blueprint that come in the Animation Starter Pack. We will add the following states to the State Machine:

  • Prone
  • ProneToStand
  • StandToProne

We will use the project created at the start of the chapter, which is using the Character from the Animation Starter Pack.

First, let's create the input mappings that we are going to use in our example. We will create two input actions: Crouch and Prone.

Note

The actions and states for the Crouch input action are already present in the Animation Starter Pack. To make Crouch work, we just need to add, in Project Settings, an action mapping named Crouch.

Follow these steps to create the input mappings:

  1. Click the Settings button on the far right of the toolbar, and then select the Project Settings… option:

Figure 17.30 – Accessing Project Settings

  1. On the left side...

Summary

This chapter presented some animation concepts, focusing on Animation Blueprints. We looked at Animation Editor, Skeleton, Skeletal Mesh, Animation Sequence, and Blend Space.

This chapter showed how to use the EventGraph and AnimGraph of an Animation Blueprint. We also learned how to create State Machines in the AnimGraph.

We also saw a practical example of how to add states to the Character of the Animation Starter Pack.

In the next chapter, we will learn how to create Blueprint libraries and components that can be used throughout a project.

Quiz

  1. A Blend Space allows the blending of animations based on parameters.

a. True

b. False

  1. An Animation Blueprint has AnimGraph but doesn't have an EventGraph.

a. True

b. False

  1. The Output Pose node needs to be the final node of an Animation Graph.

a. True

b. False

  1. A State Machine is an independent auxiliary asset that contains a fixed set of named constants.

a. True

b. False

  1. The transition from one state to another is controlled by a Transition Rule.

a. True

b. False

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition
Published in: May 2022Publisher: PacktISBN-13: 9781801811583
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Authors (2)

author image
Marcos Romero

Marcos Romero is the author of the Romero Blueprints blog, which is one of the main references on the internet to learn about Blueprints. Epic Games invited Marcos to the Unreal Engine 4 closed beta program to experiment and collaborate with the evolution of the tools. He was also one of the first recipients of Unreal Dev Grants for Education. Marcos is a well-known figure in the Unreal community and, for Epic Games, he wrote the official Blueprints Compendium and Blueprints Instructor's Guide.
Read more about Marcos Romero

author image
Brenden Sewell

Brenden Sewell is a game designer and creative director with over a decade of experience leading teams in the development of compelling interactive experiences that entertain and inspire. Prior to joining Bossfight Entertainment to work on some upcoming secret projects, he explored the intersection of social impact and entertainment serving as the Creative Director for E-line Media. He has led developments from concept to live support on a variety of games ranging from a brain-training first-person shooter to a construction sandbox exploring the future of digital fabrication.
Read more about Brenden Sewell