PixPoly
All videos

Character Blueprint in Unreal Engine 5: character, camera and controls from a blank project

7:57

First episode of the locomotion series. We start from an empty project and set up the Character Blueprint, the Game Mode, the camera on a Spring Arm and Enhanced Input — the clean base everything else will graft onto.

A clean locomotion system starts with a properly configured character. So we begin from a blank project, no template: every piece is placed deliberately, and nothing lingers whose origin you do not know.

The level and the default map

  1. 1Create a Map folder and save the current level inside it.
  2. 2In the Project Settings, search for “map” and fill in Editor Startup Map and Game Default Map.

On a blank project, Unreal needs at least one saved level to store your progress properly. Setting the default map then saves time every time you open the project.

The two classes

Import the character into a Character folder — default import settings. Then create a Blueprint folder, with two classes inside.

ClassRole
BP_MyCharacterType Character. Displays the character, carries the camera and the movement logic.
BP_MyGameModeType Game Mode. Tells the engine which character to use at launch.
  1. 1In the Game Mode, Default Pawn Class line, select BP_MyCharacter.
  2. 2Open Window ▸ World Settings and set BP_MyGameMode in GameMode Override.

The mesh inside its capsule

Select the Mesh component and assign the character’s Skeletal Mesh. It then has to be placed correctly, and that matters more than it looks.

  • Position: feet at the bottom of the capsule, body entirely inside it.
  • Rotation: the character faces the same direction as the arrow.
  • Capsule: adjust its shape in the details so it fits the character.

Turn snapping off while you do this: at 10 units a step, you never quite land the feet exactly at the bottom of the capsule.

The camera on a Spring Arm

On the capsule, add a Spring Arm, and on the Spring Arm a Camera. The Spring Arm sets the distance between camera and character, and above all handles collisions on its own: if there is a wall behind the character, the camera repositions itself.

The controls: two notions

ElementWhat it defines
Input Mapping ContextWhich keys are active.
Input ActionWhich values a key returns.
  1. 1Create an Input folder, then an IA_Move Input Action of type Axis2D — X for left and right, Y for forward and back.
  2. 2Create an IMC_Default Input Mapping Context, add a mapping to IA_Move and assign four keys.
  3. 3On the forward and backward keys, add a Swizzle Input Axis Value modifier: without it they would return their value on the X axis.
  4. 4On the backward and left keys, add a Negate modifier to get negative values.

By default, a key returns a value between 0 and 1 on the X axis alone. The Swizzle moves that value onto the axis you want, the Negate flips its sign. The whole keyboard mapping rests on those two modifiers.

Wiring the controls into the character

  1. 1In the BP_MyCharacter Event Graph, on Event BeginPlay, call Get Enhanced Input Local Player Subsystem then Add Mapping Context with IMC_Default.
  2. 2Add the IA_Move event and two Add Movement Input nodes.
  3. 3Use Get Control Rotation to know where the camera is pointing, and keep only the Z axis.
  4. 4Feed it into Get Forward Vector and Get Right Vector, wired into the World Direction inputs.
  5. 5Split Struct Pin on Action Value: X into the Scale Value of the right vector, Y into that of the forward vector.

The camera follows the same mechanic: duplicate IA_Move into IA_Look, assign it Mouse XY 2D-Axis with a Negate on the Y axis, and wire both axes into Add Controller Yaw Input and Add Controller Pitch Input.

Three checkboxes

SettingStateEffect
Orient Rotation to MovementCheckedThe character turns towards where it is heading.
Use Controller Rotation YawUncheckedThe camera turns without dragging the character along.
Use Pawn Control Rotation (Spring Arm)CheckedThe camera follows the mouse, independently of the character.

The jump

  1. 1Create an IA_Jump Input Action, boolean this time.
  2. 2Give it two triggers: Pressed and Released.
  3. 3Assign it the space bar in IMC_Default.
  4. 4In the character, wire Started into Jump, and both Canceled and Completed into Stop Jumping.

It is the Stop Jumping on release that lets you meter the height of the jump. Without it, every press gives the same jump.

The character moves, the camera follows, the jump responds. In the next episode, the Animation Blueprint gives all of it real animations.