Language:
Page Info
Skill Level:
Engine Version:

2.2 - Setting up Axis Mapping

Choose your OS:

In general, Axis Mappings allow us to map keyboard, mouse, and controller inputs to a "friendly name" that can later be bound to game behavior, such as movement. Axis Mappings are continuously polled, allowing for seamless movement transitions and smooth game behavior. Hardware axes (such as controller joysticks) provide degrees of input, rather than discrete input (1 - pressed vs. 0 - not pressed). While controller joystick input methods are effective at providing scalable movement input, Axis Mappings can also map common movement keys, like WASD to continuously-polled game behavior. If you want to learn more about Player Input before moving forward with this step, please refer to the Player Input and Pawns tutorial.

During this step, we're going to get our new Character to move around the map by setting up the input axis mappings for the W, A, S, and D keys.

MoveForward Axis Mapping

  1. In the Edit menu, click on Project Settings.

  2. Under the Engine heading on the left side of the Project Settings tab, click on Input.

  3. Under Bindings, click on the plus sign next to Axis Mappings.

  4. Click on the arrow to the left of Axis Mappings.

  5. Type "MoveForward" into the text field that appears, then click on the arrow to the left of the text box to expand the axis binding options.

  6. In the dropdown menu, select W from the Keyboard dropdown list.

  7. Your input settings should now look like the following:

    MoveForwardAxisMap_W.png

  8. Click on the plus sign next to MoveForward.

  9. In the second dropdown menu, select S from the Keyboard dropdown list.

  10. Type "-1" in the Scale field next to S.

  11. Your input settings should now look like the following:

    MoveForwardAxisMap_S.png

MoveRight Axis Mapping

  1. Under Bindings, click on the plus sign next to Axis Mappings.

  2. Type "MoveRight" into the text field that appears, then click on the arrow to the left of the text box to expand the axis binding options.

  3. In the dropdown menu, select D from the Keyboard dropdown list.

  4. Your input settings should now look like the following:

    MoveRightAxisMap_D.png

  5. Click on the plus sign next to MoveRight.

  6. In the second dropdown menu, select A from the Keyboard dropdown list.

  7. Type "-1" in the Scale field next to A.

  8. Your input settings should now look like the following:

    MoveRightAxisMap_A.png

  9. Now that you've set your MoveLeft and MoveRight Axis Mappings, go ahead and close the Project Settings menu.