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.
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.
Create a C++ class,
Warrior
, deriving fromCharacter
:UCLASS() class CH6_API AWarrior : public ACharacter { GENERATED_BODY() };
Launch UE4, and derive a Blueprint,
BP_Warrior
, based on yourWarrior
class.Create and select a new Blueprint for your
GameMode
class as follows:Go to Settings | Project Settings...