Axis Mappings – keyboard, mouse and gamepad directional input for an FPS character

There are two types of input mapping: Axis mappings and Action mappings. Axis mappings are inputs that you hold down for an extended period of time to get their effect (for example, holding the W key to move the player forward), while Action mappings are one-off inputs (such as pressing the A key on the gamepad to make the player jump). In this recipe, we'll cover how to set up keyboard, mouse, and gamepad axis-mapped input controls to move an FPS character.

Getting ready

You must have a UE4 project, which has a main character player in it, and a ground plane to walk on, ready for this recipe.

How to do it...

  1. Create a C++ class, Warrior, deriving from Character:
    UCLASS() ...

Get Unreal Engine 4 Scripting with C++ Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.