How to Set up Chaos Vehicles

This guide explains how to set up a vehicle to use the Chaos Physics Solver.

Windows
MacOS
Linux
Prerequisite Topics

This page assumes you have prior knowledge of the following topics. Please read them before proceeding.

The individual assets that make up a vehicle are as follows.

  • A Skeletal Mesh

  • A Physics Asset

  • An Animation Blueprint

  • A Vehicle Blueprint

  • One or more Wheel Blueprints

These are the same no matter whether you are creating an automobile or a motorcycle. Putting together these assets, this guide will guide you through the following process of setting up a Chaos Vehicle.

  1. Enabling the Chaos Vehicles Plugin.

  2. Creating and Editing Chaos Wheel Blueprints.

  3. Importing a Vehicle Mesh.

  4. Creating an Animation Blueprint with the Vehicle Handler node.

  5. Creating a Vehicle Blueprint.

  6. Setting up Vehicle Control Inputs.

  7. Setting up the Vehicle Game Mode.

Requirement

Before using the Chaos Vehicles Plugin, you will need to compile Chaos to enable it.

To learn how to enable the Chaos Physics Plugin, read the Chaos Physics Overview.

Chaos Vehicles Plugin

In Edit > Plugins > Vehicles, verify the ChaosVehiclesPlugin is enabled for your project.

ChaosVehiclesPlugin.png

  • Restart Unreal Editor after enabling the plugin.

  • This plugin will not work with PhysX enabled.

Chaos Wheel Blueprints

The wheel Blueprint is where the configuration for a Wheel/Suspension/Brakes combination is set up.

In most cases, you will require at least two wheel types per vehicle. A wheel (or axle) that is affected by the steering/engine/handbrake, and one that is not. Also, you may require differently sized wheels for the front or the back, in which case, you have full control over setting the differing radii, mass, width, handbrake effect, suspension, and many other properties for those wheels to give your vehicle the handling you desire.

There is no limit on the number of wheels that a vehicle may have. It is possible for multiple vehicles to share the same Wheel Blueprints, but this strategy is only valid if the wheel dimensions and suspension limits are the same.

Create a Blueprint

  1. In the Content Browser, click Add New, and select Blueprint Class.

  2. In the Pick Parent Class window, under All Classes, search for "wheel" and select ChaosVehicleWheel.

  3. The new asset will be created in the Content Browser. Make sure to give it a recognizable name so that you can easily locate it later (for example, 'BP_ChaosFrontWheel').

  4. (Optional Step) Repeat these steps again so that you have a front and rear wheel type. Set them up on a per-axle basis.

Edit a Blueprint

Now that you have created the Chaos Wheel Blueprint(s), open them in the Blueprint Editor, where there are options to edit the wheels.

To start, there are five properties that need to change for each wheel, as the rest of the properties depend on how the vehicle performs (and should be tweaked later on) during testing.

Property

Notes

Wheel Radius

This needs to match the size of the render model in centimeters (cm).

Affected by Handbrake

Check this in the rear wheels.

Affected by Engine

Check the rear wheels for rear-wheel drive (RWD), the front wheels for front-wheel drive (FWD), and all of the wheels for all-wheel drive (AWD).

Affected by Steering

Check the front wheels, possibly more than two — for example, a truck cab might have four-wheel steering with the second layer having a different steering angle. Alternatively, all-wheel steering is possible by selecting steering on the rear wheels with a negative steering angle.

Max Steer Angle

Normally, this is a positive value (specified in degrees), however, a negative value is allowed for rear-wheel counter-steering with all-wheel steering.

ChaosWheelBlueprint.png

Example Class Defaults for the Chaos Wheel Blueprint.

Vehicle Mesh

If you would like to continue following along, we recommend importing a vehicle mesh to your project. If you do not have a Vehicle mesh, you can download and extract this sample vehicle mesh.

For illustrative purposes, we are using the Buggy vehicle mesh from the Vehicle User Guide.

Vehicle Physics Editor

After importing a vehicle mesh to your project, follow these steps to view the mesh in the Vehicle Physics Editor.

  1. From the Content Browser, locate your vehicle Skeletal Mesh.

  2. Double click the vehicle Skeletal Mesh.

  3. To open the Vehicle Physics Editor, select Physics.

    PhysicsTabEditor.png

  4. The Vehicle Physics Editor should look like the following.

    PhysicsTabEditor1.png

Vehicle Animation Blueprint

Animation Blueprints are used to control Vehicle Skeletal Mesh animations specific to that vehicle, such as spinning tires, suspension, handbrakes, and steering animations. To offload a lot of the work in creating these types of animations, you can use the Wheel Controller Node to drive the animations.

Wheel Controller Node

Where an Animation Blueprint is used to get and control animations for the vehicle, the Wheel Controller node makes controlling all of the animations for the vehicle straightforward with little to no additional setup.

WheelComponent.png

The node gets the necessary information from the wheels (such as "How fast is it spinning?" or "Is it affected by the Handbrake?" or "What are the suspension settings for this wheel?"), and translates the query results to an animation on the bone that the wheel is associated with.

Create an Animation Blueprint

  1. In the Content Browser, click Add New, then hover over Animation, and select Animation Blueprint.

  2. In the Create Animation Blueprint window, locate and select the Skeleton from your vehicle's list, and then click OK.

  3. Name the Vehicle Animation Blueprint.

  4. Now that there is an Animation Blueprint to work from, open it from the Content Browser.

  5. From the main toolbar, select Class Settings, and in the Details panel under Class Options, set the Parent Class to VehicleAnimationInstance.

    VehicleAnimInstance.png

    Setting the Parent Class

  6. Right-click in the Anim Graph to open the context menu to search for and select the Mesh Space Ref Pose node.

  7. Next, right-click in the Anim Graph to search for and create the Wheel Controller.

  8. Now, connect the nodes so that your Anim Graph looks like this one.

    WheelController.png

    Sample Anim Graph

  9. (Optional Step) If you have additional struts or other suspension needs (like the sample Buggy from Vehicle Game), you will need additional nodes in the Animation Graph to handle the joints that affect those polygons. For example, in the Buggy, from Vehicle Game, the extra joints are used to control the axle connections to the wheels. These are driven by Look At nodes, which, when given the wheel joints, will be driven by the Wheel Controller node; the Look At nodes will ensure the suspension stays attached to the wheels, as demonstrated in the following example.

WheelControllerLookAtNode

With the following Look At node composition.

Bone

Look At

F_L_Suspension

F_L_wheelJNT

F_R_Suspension

F_R_wheelJNT

B_L_Suspension

B_L_wheelJNT

B_R_Suspension

B_R_wheelJNT

B_L_wheelJNT

B_L_Suspension

B_R_wheelJNT

B_R_Suspension

From the example Buggy Skeleton Tree

NewBuggyBlueprintSkeletonTree

Create a Vehicle Blueprint

In this step, you will create the Vehicle Blueprint, bringing together all the assets that were previously set up.

  1. In the Content Browser, click Add New, and select Blueprint Class.

  2. In the Pick Parent Class window, under All Classes, search for "wheel" and select WheeledVehiclePawn.

  3. Name the Vehicle Blueprint.

  4. From the Content Browser, select and open your newly created Vehicle Blueprint.

  5. From the Components window, click the Skeletal Mesh Component named Mesh. Then, in the Details panel, set the Skeletal Mesh to your vehicle's Skeletal Mesh asset.

  6. Set the Blueprint Generated Anim Class to the vehicle's Animation Blueprint.

  7. In Details under Physics, enable Simulate Physics.

  8. From the Components window, click Add Component, and select Camera.

  9. Use the Viewport in the Blueprint Editor to position the Camera.

    ViewportView.png

    In this example, the camera is positioned behind, slightly raised, and tilted down towards the vehicle.

  10. With the Camera component still selected (in the Details panel under Camera Settings), verify that Use Pawn Control Rotation is disabled.

    This ensures that the camera is locked to its view direction rather than the Player Controller's view direction.

  11. Next, select the Vehicle Movement Component in the Components window.

  12. In the Details panel under Vehicle Setup section, expand the arrow next to Wheel Setups and set the following for each wheel:

    • Set the Wheel Class to the Wheel Blueprint(s) you created.

    • Set the Bone Name to the name of the joint that should be controlled by the wheel.

The order you assign wheels has no bearing on if it is a front or a rear wheel, only the Bone Name and Wheel Class have any effect. For organizational purposes, we recommend keeping the wheels in the same order for each new vehicle (for example, FL, FR, BL, BR).

If the vehicle requires more than 4 wheels, click the + icon next to the Wheel Setups property to add more, or conversely remove wheels as needed.

Vehicle Control Inputs Setup

  1. Go to the Main Menu and select Edit > Project Settings to open the Project Settings window.

  2. Under the Engine section in the side panel, select Input.

  3. Set up control inputs for steering, throttle, brake, and handbrake as seen below, this is using the analog inputs of the game controller for all but the handbrake.

    InputSetup.png

  4. Now that you've got the controls set up, you'll need to actually do something with them. 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.

  5. Make the connections from the input events to the vehicle component set input functions.

    InputEventGraph.png

Vehicle Game Mode Setup

  1. In the Content Browser, click Add New, and select Blueprint Class from the menu list.

  2. In the Pick Parent Class window, select Game Mode Base, and then click Select to create the Game Mode Blueprint.

    BluePrintGameMode.png

  3. In the Content Browser, double-click to open the new Game Mode Blueprint so that you can edit it.

  4. In the Details under Classes, next to Default Pawn Class, use the drop-down selection to choose your Vehicle Blueprint.

    defaultPawnClass1.png

  5. Click Save and then Close the window.

  6. In the Main Viewport window, in the World Settings tab under the Game Mode section, set GameMode Override to your Game Mode Blueprint.

    Click for full image.

At this point, you've worked through the process of setting up a Chaos Vehicle, and you're ready to run the vehicle in your game.

If you have an existing PhysX vehicle that you want to convert to Chaos, there is a different process, which you can learn about in this PhysX to Chaos Vehicle Conversion guide.

Select Skin
Light
Dark
Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss

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