Skip to content
Tutorials Center
My learning

Topics

Lesson 19 of 38 ยท Blueprints

Unreal Enhanced Input: Player Movement, Camera and Controls

Set up player controls with Enhanced Input: Input Actions, Mapping Contexts, modifiers and triggers, move and look in a Character Blueprint, jump, and gamepad support.

A game needs input: keyboard, mouse, gamepad or touch. Unreal 5 uses the Enhanced Input system, where you define what the player can do (jump, move, fire) separately from which buttons do it. That lets one set of Blueprints work with keyboard, controller and remapping. This lesson builds the standard setup used by the Third Person template.

Unreal Engine cannot run on this page, so steps are described in words. The stand-ins simulate input processing so the ideas are clear.

The idea

flowchart LR
  K["Keys and sticks"] --> M["Input Mapping Context"]
  M --> A["Input Action (Move, Jump, Look)"]
  A --> S["Triggers and Modifiers"]
  S --> B["Blueprint event: Triggered"]

Hardware is mapped to actions; Blueprints only listen to actions.

Enhanced Input has four asset types:

  • Input Action (IA_): one abstract thing the player can do, with a value type: Digital (bool) for jump, Axis1D (float) for a throttle, Axis2D (Vector2D) for move and look, Axis3D for motion.
  • Input Mapping Context (IMC_): a list that maps keys or buttons to actions, with modifiers and triggers per mapping.
  • Modifiers: adjust the raw value, for example Negate, Swizzle Input Axis Values (to send W/S into the Y component), Dead Zone, Scalar (sensitivity), Smooth.
  • Triggers: decide when the action fires: Pressed, Released, Down, Hold, Tap, Pulse, Chorded Action.

Creating the assets

In the Content Browser: Add > Input > Input Action and name it IA_Jump (Value Type Digital), IA_Move (Axis2D), IA_Look (Axis2D). Create an Input Mapping Context called IMC_Default. Open it and add mappings:

Action Key Modifiers
IA_Jump Space Bar (none)
IA_Move W Swizzle Input Axis Values (YXZ)
IA_Move S Swizzle (YXZ), Negate
IA_Move D (none)
IA_Move A Negate
IA_Move Gamepad Left Thumbstick 2D-Axis Dead Zone
IA_Look Mouse XY 2D-Axis Negate (Y)
IA_Look Gamepad Right Thumbstick 2D-Axis Dead Zone

Newer versions offer a DefaultInputMappingContext in the templates. The ProjectSettings > Input > Default Classes must use Enhanced Player Input and Enhanced Input Component (set by default in new 5.x projects).

Python Stand-in: turning keys into a move vector

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Pressing W and D gives (1, 1), which is longer than 1; the movement function normalizes it so diagonals are not faster. The Character Movement component does that for you through Add Movement Input.

Adding the context to the player

Contexts are added at run time to the player's Enhanced Input Local Player Subsystem. In the Character (or Player Controller) Blueprint, on Event BeginPlay:

  1. Get Player Controller and cast it to a Player Controller (or use the controller from Event Possessed / Event Receive Controller Changed).
  2. Get Enhanced Input Local Player Subsystem from the local player.
  3. Add Mapping Context with IMC_Default, priority 0.

You can add and remove contexts any time, so a vehicle or menu can have its own bindings. Higher priority contexts can consume an input before lower ones see it.

Binding actions in the Character Blueprint

Right-click the Event Graph and search for your action: EnhancedInputAction IA_Move. It offers pins:

  • Triggered: fires each frame while the action is active (movement and look).
  • Started, Ongoing, Canceled, Completed.
  • Action Value (the Vector2D) and Elapsed Seconds.

Move:

  1. From IA_Move > Triggered, break the Action Value into X and Y.
  2. Compute the camera's yaw rotation: Get Control Rotation, make a rotator with only Yaw.
  3. Get Forward Vector of that rotator and Add Movement Input with World Direction and Scale Value Y; Get Right Vector for Scale Value X.

Look: IA_Look > Triggered calls Add Controller Yaw Input (X) and Add Controller Pitch Input (Y).

Jump: IA_Jump > Started calls Jump and Completed calls Stop Jumping. The Character class provides both.

The Character's Spring Arm (with Use Pawn Control Rotation on) carries the Camera, and Character Movement > Orient Rotation to Movement makes the mesh turn toward travel direction.

Python Stand-in: camera-relative movement

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

When the camera turns 90 degrees, W moves along the world Y axis, which is why movement is built from the camera (control) rotation.

Game mode, pawns and possession

Which Character does the player control? The Game Mode names a Default Pawn Class. Set it in World Settings > Game Mode Override, or in Project Settings > Maps & Modes. The Player Start actor in the level tells where to spawn. The Player Controller possesses the spawned pawn; Auto Possess Player on a pawn placed in the level also works for single-player tests.

Gamepad, remapping and UI

  • Add gamepad keys to the same actions; Enhanced Input handles both automatically.
  • For key remapping, define Player Mappable keys and use the Enhanced Input User Settings (newer versions) so players save their bindings.
  • UI: set Input Mode UI Only / Game and UI with the nodes Set Input Mode Game Only / UI Only and show the cursor when menus open.

If nothing happens when you press a key: confirm the mapping context was added (Print String on BeginPlay), that the Character is the possessed pawn, and that Input > Default Classes use the Enhanced Input classes.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What does an Input Mapping Context contain?

    Contexts map hardware inputs to abstract actions, with modifiers and triggers.
  2. 2. Which value type fits a 2D move input?

    Move combines forward/back and left/right, a two-component value.
  3. 3. Where do you usually add the mapping context at run time?

    The subsystem's Add Mapping Context node activates a context for the local player.
  4. 4. Why build movement from the control rotation's yaw?

    Using the camera yaw makes forward mean 'away from the camera'.

Summary

  • Enhanced Input separates Input Actions from Mapping Contexts, with modifiers and triggers.
  • Add the context at run time, then bind Triggered, Started and Completed events in the Character.
  • Build move direction from the control rotation and call Add Movement Input; look uses controller yaw and pitch.
  • The Game Mode and Player Start decide which pawn the player controls.

Next: Your First C++ Actor Class