Minimal Bus Setup

The goal of the minimal bus setup is to be able to drive the bus in engine. This is the base functionality of the bus and more features can be added later.

This section expects that you have a bus mesh with at least the basic skeleton setup and have setup a plugin for your bus.

Add reference content to plugin

Select the files you want to copy in the content browser, drag them over the folder for your new plugin and select "Copy Here"


We provide two buses as starting point for your bus, one normal bus and one bendy bus. Use the one that is suitable for your bus as reference and copy the "Setup Data Asset", the "Mod Info" and the bus blueprint, usually called VH_Manufacturer_BusModel, to your plugin folder.

 

Import your bus


Import the bus mesh by clicking the import button in the content browser or by dropping it into the plugin folder in of your bus in the content browser.

Use these import settings:

Animation Import Setting

 



Check if the skeleton was correctly imported


It is very important that the bus skeleton is setup in a specific way. The bus will not be drive able if the skeleton deviates from how unreal expects it.

Check if the skeleton fulfills the following criteria:

  • The root bone is at the center of the bus.

  • The root bone must not have any parent bones. It needs to be the root to all other bones.

  • The root bone has a location of 0,0,0, a rotation of 0,0,0 and a scale of 1,1,1. Small floating point deviations are fine, but it can easily happen, that the root bone comes with a 90° rotation or a scale is at 100 from your moddeling program, with those offsets you will not be able to drive the bus

  • The tire bones need to be direct children of the root bone

  • The tire bones need to have a specific orientation: X forward, Y right, Z up

 

 

Setup the bus blueprint for the new mesh

Open the blueprint you copied over to your plugin and replace the skeletal mesh used on the "Mesh" root component with the skeletal mesh you just imported. This should allow you to see your bus in the viewport of the blueprint.

Scroll down in the "Components" window until you find the "VehicleMovement (Inherited)" component

Select it and search for the "Wheel Setups" list in the details

Expand the list and check if the "Bone Name" entries correspond with the bone names in the skeleton of your bus, if not change the entries to the ones used in your skeleton.

Check if the parent sockets of the wheel static meshes are set to the wheel bones of the bus

 

Physics Asset


The minimal bus physics asset will only enable the bus to drive, it will be extended in the full bus setup.

The physics asset for the bus was created on import. Unreal automatically creates some colliders for you, but they are not needed and you can delete the to get a clean physics asset.
After deleting all colliders add a box collider to the root and a sphere collider to each wheel. For the initial setup the don't need to fit the bus perfectly yet, but we recommend, that you setup your root collider as bus floor collider. The game checks if you are inside a bus by checking what is below you. Certain actions, like boarding the bus, are only active if the game thinks your are inside a bus.

On the box colliders attached to the root, make sure under Collision the Simulation Generates Collision Events is checked.

Root bone collider settings

Enable Gravity

true

Physics Type

Default

Simple Collision Physics Material

PM_Bus

Collision Response

true

Wheel bone collider settings

Enable Gravity

true

Physics Type

Kinematic

Simple Collision Physics Material

None

Collision Response

false

Setup bus boarding point


We use a bone location to mark the boarding point to the bus, in most buses we use the DriverDoor bone.
If you already have the full skeleton setup done you can skip to the connect bone to action step.


Add socket as boarding point


In the skeleton asset of the bus add a socket to the root bone and give it a name like "DriverDoor" or "BoardingInteractible".
Move this bone to the cockpit area so you can board by interacting with the boarding area.

Connect bone to action


We need to tell the bus that if a user interacts with a specific bone it should trigger a specific action, in this case if the user interacts with the cockpit area it should trigger the boarding action and allow the user to drive the bus.
To set this up open the bus blueprint and search for the SkeletalMeshInteractible component in the components window. You will see there are already a couple mappings between bone name and interaction setup. Either add a new entry or edit an existing one, type the name of the bone/socket into the textbox and select "InteractibleType_BusBoarding" as interactible type.

Testing and Troubleshooting

Testing if the minimal setup works if fairly straight forward:

  • drag you bus blueprint into the test scene

  • press play

  • check if you can board and drive the bus

If you can you are good to go and can continue to the full bus setup.


Troubleshooting

The bus is floating in the air and can't be interacted with

  • check in the skeletal mesh asset, if the physics asset is set to the one you prepared

  • check if the root as well as the wheels have colliders setup

  • many errors are connected to the incorrect skeletons, check the checklist again to see if everything is setup correctly

  • check if the wheel setup in the Vehicle Movement component references the correct bones

The bus sits nicely on the floor, but you can't board it

  • check if the bus boarding interactible is correctly setup

  • check your collider setup, you can only board the bus when the game thinks you are inside a bus. Make the root collider you created before into a floor collider, once the game sees a bus below your feet it will allow you to board a bus.

Next Step

Full Bus Setup in Engine

Â