5 - Setting up and Testing Functionality

In this step, we'll setup functionality to control our vehicle.

Windows
MacOS
Linux

By now, you've done everything you need to do to have a fully functional vehicle by creating the Wheel, Animation, and Vehicle Blueprints in Unreal Engine 4, except to be able to control it in your game! In this step, we'll show you how to set up the necessary axis mappings and bindings so that you can drive the vehicle around and fully test its capabilities.

Because there are a few ways to go about setting up the vehicle for testing, and assuming that you started with a blank project template, all of the inputs will need to be added to control the vehicle. If you started with an existing template, some (or all) of these axis mappings and bindings may already be available for you in your project.

Setting Up The Controls

  1. Go to the Main Menu and select Edit > Project Settings to open the Project Settings window. Then, under the Engine section in the side panel, select Input.

    input.png

  2. In the Bindings menu, set up the following controls (if you do not currently have them listed). If you do have them listed, it would be wise to double-check that they are set up like the ones listed here, so that you know your vehicle will work correctly.

    1. First, we'll setup an Action Mappings by clicking the + sign next to the Action Mappings property.

      1TF.png

    2. Rename the Action Mapping from "NewActionMapping_0" to Handbrake. Then, expand this property to use the selection box to change the key value from "None" to Space Bar.

      2TF.png

    3. Next, we'll setup the Axis Mappings by clicking the + sign next to the Axis Mappings property. Repeat this so that you have two Axis Mappings, like this:

      3TF.png

    4. Rename the first Axis Mapping from "NewAxisMapping_0" to Forward. Then do the same for the second and rename it from "NewAxisMapping_1" to Right.

      4TF.png

    5. Expand the Forward Axis Mapping and then click the + sign once so that you have two Axis Mappings listed under "Forward". Then set the first "None" to use the W key for input. Set the second "None" to use the S key.

      5TF.png

    6. Next to the S key input under the Forward Axis Mapping, change the Scale value to be -1.

      6TF.png

    7. Expand the Right Axis Mapping and then click the + sign once so that you have two Axis Mappings listed under "Right". Then set the first "None" to use the D key for input. Set the second "None" to use the A key.

      7TF.png

    8. Next to the A key input under the Right Axis Mapping, change the Scale value to be -1.

      8TF.png

    Once you're done setting the Action and Axis Mappings, your Bindings should look like this:

    SetupInputs.png

  3. Now that you've got the controls set up, you'll need to actually do something with them. So, open up the Vehicle Blueprint that you created and locate the Event Graph, where you'll be able to call these Axis and Action events that you created in the Project Settings Input section.

    MyVehicleBP.png

  4. In the Event Graph, for the throttle setup create the following:

    throttleBP.png

  5. In the Event Graph, for steering setup the following:

    steeringBP.png

  6. In the Event Graph, for the handbrake setup the following:

    handbrakeBP.png

End Result

Now with these Input Events added you have a fully functional vehicle that can take input movement! In the next and final step, you'll set up a new Game Mode that uses your Vehicle pawn as the default pawn when you launch a game.

Tags
Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback