Vehicle Setup Guide

Download

A template version of this tutorial is available here. It is still recommended to follow the tutorial if this is your first time setting up a vehicle, in order to understand the workings of the plugin.

AVS Template Download

Requirements

              (A basic static mesh body and wheel are included in the plugin for demo purposes, you must check “Show Plugin Content” in the view options to see it)

Step 0: Optional - Configure Project Settings

Consider making the recommended changes from the Project Settings page, they will dramatically increase physics stability, and top speed in the physics wheel mode.

Step 1: Configure your Inputs

Before we can setup the vehicle, we need to know what our inputs are. So head into your Project Settings > Input and set up something similar to this image.

Step 2: Create the Base Vehicle

2A

Create a new blueprint and choose the base class “AVS_Vehicle” as the parent class. 

It is recommended to name this blueprint "ProjectName_Vehicle" to facilitate sharing code, settings, and components among all vehicles in your project. 

2B

2C

Open the Event Graph. 

By default, the vehicle is not running and in park. For simplicity, we will start the engine and shift into drive on BeginPlay so the vehicle is ready to drive later when we press play.

2D 

While we are in the event graph, we'll also setup the vehicle inputs.

(Optional) Set up Automatic Shifting

AVS 1.2.5 added an additional option for automatic shifter positions. If you would like to use this feature you will need to slightly change the configuration above.

Step 3: Create your Vehicle

3A

Right click on your base vehicle blueprint and select “Create Child Blueprint Class”, this will be your actual vehicle so you can name it accordingly. For the tutorial I will name mine “Car”. 

3B

Open your new vehicle blueprint, then select the VehicleMesh component from the list and set it to your desired mesh. AVS comes with a placeholder mesh in it's content. 

Note:
(If the plugin is installed to the engine) you'll have to check "Show Engine Content" in the content drawer in order to view the plugin content.
(If the plugin is installed to the project) you'll have to check "Show Plugin Content" in the content drawer in order to view the plugin content.

3C

Wheels in AVS are separate components called "Vehicle_Wheel". Each wheel component holds the data for the wheel its representing, so you can configure every wheel individually. 

You'll need to add one for each wheel you need on the vehicle. Then reposition each component to its appropriate location on the vehicle. 

For better productivity and organization, it is advisable to name the components based on their specific locations on the vehicle. 

Step 4: Configure your Vehicle

4A

Select ClassName(self) in the components list or press the “Class Defaults” button, you will notice in the details panel there are categories Prefixed “Vehicle -”. These are where you configure values related to the vehicle as a whole. For now we just want to edit the transmission values, so open “Vehicle - Transmission”. 

4B

In the “Gears” section you will see there are 2 gears by default. Gear 0 will always be the reverse gear, and then everything after is a forward gear. 

Add 2 more gears, then configure them similar to the following image.

Explanation of Gear Variables

End Speed -- Intended maximum speed of this gear Torque will be at MinTorque at this speed, and will decrease exponentially beyond this speed. The unit of speed is determined by the SpeedUnit setting in the vehicle


Start Speed -- Intended minimum speed of this gear Torque will be at MaxTorque at this speed, and will interpolate between MaxTorque and MinTorque between this speed and EndSpeed. The unit of speed is determined by the SpeedUnit setting in the vehicle


Up/Down Shift -- Speed at which the transmission will choose a new gear


Min/Max Torque -- The torque values used to be arbitrary, they were roughly based on the values used by the physics constraint motors in UE4. In AVS 1.4 that changed and it now represents (Nm * 0.01), or hectonewton meter (hNm). So a value of 50 equals 5000 Nm applied at the wheel. 


Low/High RPM -- Right now, RPM values are purely cosmetic, since there is not a true engine sim happening under the hood (yet!). For now, these values simply fake a value by guessing from the current engine load and throttle values, so that we have something to plug into cosmetic components such as engine audio.


3C

Now you’ll want to configure your wheel components. 

Select one of your wheels from the details panel.

Open the "Wheel Config" section.

Wheel Static Mesh:

Drive/Steer:


Step 5: Setup the config assist HUD

The plugin includes a basic HUD to assist in the creation of vehicles. This step is not required but is recommended if you are not extremely familiar with Unreal Engine. 

5A

Create both a player controller blueprint and a game mode blueprint. 

5B 

Open the new player controller, drag off the execution pin on Event Begin Play. Then type “Create Widget” in the box, and press Enter. Set the new Create widget node to the VehicleSetup HUD. Then grab the return value and use it to create the “Add to Viewport” Node. Lastly set the owning player to Self. 

Note:
(If the plugin is installed to the engine) you'll have to check "Show Engine Content" in the content drawer in order to view the plugin content.
(If the plugin is installed to the project) you'll have to check "Show Plugin Content" in the content drawer in order to view the plugin content.

If you need multiplayer, add a check to see if we are on the local controller.

5C

Now open your level, and click the blueprints button. You need to set your gamemode to the one you created, and then set your PlayerController within that game mode. 

Step 6: Test what you have so far

If you have successfully followed along, you should now be able to drive your vehicle. Either set the default pawn in your GameMode to your new vehicle, or place one in your level and set “Auto Possess Player 0” in the details panel. 

Once you are in the game, you can use your ShiftUp and ShiftDown inputs to move the shifter (PRND not gears), you will see it change on the HUD. However if you're using the "Automatic Shifter Position" feature this will happen automatically. 

If you want to use the buttons and sliders, press ‘SHIFT + F1’ to bring your mouse cursor up. You can also use the HUD to play with different values for your springs and find the best values. The new springs values will be applied to every wheel, overriding whatever you had set before.