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
- 1Create a Map folder and save the current level inside it.
- 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.
| Class | Role |
|---|---|
| BP_MyCharacter | Type Character. Displays the character, carries the camera and the movement logic. |
| BP_MyGameMode | Type Game Mode. Tells the engine which character to use at launch. |
- 1In the Game Mode, Default Pawn Class line, select BP_MyCharacter.
- 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
| Element | What it defines |
|---|---|
| Input Mapping Context | Which keys are active. |
| Input Action | Which values a key returns. |
- 1Create an Input folder, then an IA_Move Input Action of type Axis2D — X for left and right, Y for forward and back.
- 2Create an IMC_Default Input Mapping Context, add a mapping to IA_Move and assign four keys.
- 3On the forward and backward keys, add a Swizzle Input Axis Value modifier: without it they would return their value on the X axis.
- 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
- 1In the BP_MyCharacter Event Graph, on Event BeginPlay, call Get Enhanced Input Local Player Subsystem then Add Mapping Context with IMC_Default.
- 2Add the IA_Move event and two Add Movement Input nodes.
- 3Use Get Control Rotation to know where the camera is pointing, and keep only the Z axis.
- 4Feed it into Get Forward Vector and Get Right Vector, wired into the World Direction inputs.
- 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
| Setting | State | Effect |
|---|---|---|
| Orient Rotation to Movement | Checked | The character turns towards where it is heading. |
| Use Controller Rotation Yaw | Unchecked | The camera turns without dragging the character along. |
| Use Pawn Control Rotation (Spring Arm) | Checked | The camera follows the mouse, independently of the character. |
The jump
- 1Create an IA_Jump Input Action, boolean this time.
- 2Give it two triggers: Pressed and Released.
- 3Assign it the space bar in IMC_Default.
- 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.