In this lesson, you will learn how to bridge the gap between abstract player intentions and physical hardware by configuring Input Mapping Contexts (IMC).
The Bridge Between Intent and Action
In previous lessons, we defined Input Actions—these are the "what" of your game (e.g., Jump, Fire, Move). However, the engine doesn't yet know how to trigger these. Does Jump happen when the Spacebar is pressed, or when the Gamepad A button is tapped? An Input Mapping Context (IMC) acts as a configuration asset that maps your physical keys and buttons to these specific Input Actions.
Creating and Configuring the IMC
Think of an IMC as a collection of rules that the engine can swap out dynamically. For instance, you might have one IMC for "OnFoot" and another for "InVehicle."
To configure one:
- Right-click in your Content Browser, go to Input, and select Input Mapping Context.
- Open the asset and click the + icon next to Mappings.
- Select your
Input Action(e.g.,IA_Jump) from the dropdown. - Assign a physical key (e.g.,
Space Barfor Keyboard,Gamepad Face Button Bottomfor Controller) to that action.
Modifiers and Triggers
The power of an IMC lies in how it processes the input. You can add Modifiers to scale or negate input values, or Triggers to define when an action fires (like requiring a "Hold" or a "Double Tap").
For example, if you are configuring a movement vector, you might add a Swizzle Input Axis Values modifier to correctly map a gamepad thumbstick’s Y-axis to your character’s Forward movement.
Input Mapping Context (IMC_Default)
- IA_Jump
+ Keyboard: Space Bar
+ Gamepad: Face Button Bottom
- IA_Move (Axis2D)
+ Keyboard: W/A/S/D
+ Gamepad: Left Thumbstick
By keeping these mappings in an asset rather than hard-coding them, you allow players to remap controls easily and enable your game to support multiple control schemes simultaneously without rewriting your core character logic.
Key Takeaway: An Input Mapping Context acts as the definitive translation layer that links physical user input to your system's abstract Input Actions.