Full Setup

Example of fully setup bus collision

Collider Setup

This is an extension of the minimal setup of the physics asset. The collisions are used for players moving in the bus and making the bus drive able. Take a look at the provided bus physic assets to get a better look at how to setup the colliders

Root bone collider settings

The base collision is used for the character movement in the bus. Use boxes attached to the root bone to approximate the interior of the bus and leave holes in the approximation for the doors.

Enable Gravity|

true

Physics Type

Default

Simple Collision Physics Material

PM_Bus

Collision Response

true

Simulation Generate Hit Events

true

Wheel bone collider settings

Unreal needs a collider on the wheel bones to setup the driving physics. We normally add sphere colliders to the wheel bones, but the shape and size shouldn’t matter in this case.

Enable Gravity|

true

Physics Type

Kinematic

Simple Collision Physics Material

None

Collision Response

false

Door collider settings

Each door wing should receive a box collider approximating its shape.

Enable Gravity|

false

Physics Type

Kinematic

Simple Collision Physics Material

PM_Bus

Collision Response

true

Bendy rear part collider settings

The rear part of a bendy bus is setup similarly to the front part, but the colliders need to be parented to the root bone of the rear part.

Enable Gravity|

false

Physics Type

Kinematic

Simple Collision Physics Material

PM_Bus

Collision Response

true

The doors on the rear part are setup in the same way as the doors in the front part, only the walk able areas in the rear part are setup different.

Driver Window and Sunshade

Enable Gravity|

false

Physics Type

Kinematic

Simple Collision Physics Material

None

Collision Response

true

General Notes

Tools window with deactivated constrains generation

Be sure to remove all constraints from bones in the physics asset, they will cause the bus not work correctly, if you use the tools window to quickly generate colliders for some bones be sure to uncheck the "Create Constrains" checkbox.

Do not add a collider to the driver door bone that moves with the bone. This could cause players to get stuck in the bus after they unboard, as the moving collider can push them into the cockpit area.

 

 

 

 

 



Animation Blueprint

Create Animation Blueprint

You can create an Animation Blueprint for your bus skeletal mesh by right clicking it in the content browser → Create → Animation Blueprint.
Any Animation Blueprint created this way will have the base animation blueprint class as parent class, that needs to be changed to the BSVehicleAnimInstance class. To do that open the blueprint and go to File->Reparent Blueprint-> search for BSVehicleAnimInstance.

 

 

 

 

 

Add Animation Sequence Nodes

Search for the AnimSequence with <BSAnimStateProvider>

The AnimSequence with <BSAnimStateProvider> handles the playback of predefined animations like the door animations and the wiper animations.
Once placed in the animation blueprint you can change which animations should be played depending on a bus state.

  • Anim Sequence: select the animation that should be played

  • Anim State Provider Type: select which bus state should be checked by the node to start, stop or reverse an animation.

  • Mode:

    • Move towards target: the selected animation will play to the end when the observed state was triggered and play the animation again in reverse when the observed state was reset

    • Loop or Stay at Beginning: The selected animation will loop as long as the state is triggered, once the observed state is reset it will finish the current loop of the animation and then stop again at the start of the animation

Node overview

 

 

Animation blending

All animations setups need to be blended together, we use the "Layered Blend per Bone" Node to do that.

Each layer of the blend node can be configured to only affect certain bones, e.g. the door1 animations should only affect the bones of the first door, thus the Branch Filters will have entries for all Door1 bones.

Be sure to also add the BSWheelHandler node so that wheels can turn.

Door animations need this setup, without it you will not be able to board the bus.

Blendgraph and layer blend per bone

 

Layered blend per bone setup

 

the BSWheelHandler is used to animate the wheel correctly

 

Data Assets

Data assets are used to easily change settings on the bus without needing to dig through blueprints to find the correct settings. You can copy the data assets form a provided bus and adapt it for your purposes.

Mod Info

Important settings in mod info

This data asset contains all meta data of the bus, it is used to display information in the UI and reference the bus ingame.


Two entries in this data asset need to be set for the bus to correctly work:

  • Entry Title: The ID set here is used to reference the bus throughout the game, we normally create it by combining the manufacturer name with the model name, replace all spaces in the name with “_” and remove special characters. E.g. the ID for the MAN CNG Lion’s City is MAN_CNG_Lions_City

  • Template: This variable needs to be set to the blueprint of your bus, if it is not set, we will not be able to spawn the blueprint.

Bus Setup Data Asset

Material slot names in the skeletal mesh asset of the bus, set the data asset to these names

This data asset is used to tell the bus how it should be setup. We split the data asset into different categories to make finding variables easier.

Mirrors: The mirror cameras render their view into a texture, which is used to display the mirror view in the UI mirrors and in the bus. The mirror UVs are not always perfectly setup to correctly display the images. You can use these variables to easily flip and scale the camera image without needing to change the UVs in you modelling program and reexporting/reimporting your bus.

Lights: This is mostly used to set the intensity of different lights and how and when they should be set

Materials: We replace many materials on runtime to setup the user customization and to be able to have some dynamic material changes like rain drops while it rains and similar effects. Make sure the name set in here are the same as the slot names int the Skeletal Mesh asset of the bus.

Blueprint Setup

This is the extended version of the blueprint setup in the Minimal Bus Setup if you already completed the minimal setup you can skip the Initial Setup step.

Initial Setup

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

Replace the skeletal mesh component

 

Vehicle Movement Component

 

Wheel Setup

 

Bone attachment

 

Wheel Class

The wheel class in the wheel setup allows you to influence the braking and slip behavior of the wheels as wheel as how stiff or soft the suspension of your bus is.

 

Connect functionality

Animation class setup

Select the root mesh component in the component window and set the "Anim Class" to the animation blueprint you created earlier.

Next go to the “Class Defaults” and set the Bus Setup variable to the Bus Setup Data Asset of this bus.

 

 

 

Bus Data setup

 

 

Lights

Several lights are already setup in the bus by default, but you will most likely need to move them and change their parameters to fit your bus. You can take the provided busses as inspiration on how to setup your bus lights.
In game you can switch lights on and off individually and in groups. We use component tags to be able to tell in which group a light is and what it should react to. Every light needs to have one of the following Tags:

  • HighBeam

  • LowBeam

  • BreakLight

  • ReverseLight

  • IndicatorLightLeft

  • IndicatorLightRight

  • InteriorLight

  • CashierLight

  • CockpitLight

You can add more lights if you need them, but make sure that none of the new lights cast shadows, as this can cause performance issues!

Front Door Opener

You can place a bone or a socket on the front door or on the front of the bus which the player needs to interact with to open the door from the outside.

  1. Place a socket at the door opening position/check the name of the bone

  2. Go to the SkeletalMeshInteractible component of your bus

  3. Add a mapping entry for the front door opener

  4. Give the entry the name of the bone/socket

  5. Select the Interactible Type "InteractibleType_BusFrontDoorOpener"

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.

Doors


In the "Class Defaults" you can find the "Doors" section. Here you can setup how many doors your bus has and how they should behave.

Doors Config

Add one entry for each door in your bus

Setting

Explanation

Door

Defines which door is affected by the timing settings

Opening Delay

How long should be waited until the door opens after the user gave the command

Opening Duration

How long does it take for the door to open

Closing Delay

How long should be waited until the door closes after the user gave the command, you often hear an audio signal before the door closes

Closing Duration

How long does it take for the door to close

Door Wings Config

Add one entry for each door wing, this is used for locking and unlocking specific door wings of the bus.

Setting

Explanation

Door

Defines which door this wing belongs too

Bone Name

Name of the bone the door is weighted too

General Settings

Setting

Explanation

Door Blocked Reopen Delay

How long the doors need to be closed for, before they can be opened again

Front Door Key Effect Delay

How long it takes until the front door opens after the user interacted with the front door opener.

 

 

Door wing setup for door locks

 

Door config of one door

Camera Position

The camera position depends on the Camera Arm position.

The location of this component will be used as default camera position for the first-person mode so it should be fairly centered on the steering wheel, so the player isn’t looking at the wheel from the side.

Make sure to only move the camera arm and not the follow camera, moving the follow camera will give the camera an offset in first person causing camera movement to be weird.

Camera Arm position

Seat Adjustment Limits

To allow players to change the camera to their liking we need to setup a BusSeatAdjustmentLimits Data asset. This asset needs to be assigned to the DriverSeatAdjustment variable on the bus blueprint.

  • Default Position: default camera position when the player boards the bus for the first time

  • Forward Limit: the farthest forward and up the player can move their camera

  • Up Limit: the farthest back and down the player can move their camera

  • Adjustment Speed: how fast the camera can be moved ingame

  • Pitch Limit at Min Min Position: limits to how far up and down a player can look at when they are at the back and bottom of the limit

  • Pitch Limit at Max Max Position: limits to how far up and down a player can look at when they are at the front and top of the limit

Rearview Mirrors

The mirrors consist of three scene-capture components which are pointing back from the mirror position. Those mirrors render into a texture which will be used in the ui and in the bus material.
All three cameras are already in the bus blueprint by default, but still need to be place to the appropriate spot in the new bus. The mirrors will only update if the mirror collider is in view or if the mirror is visible in the UI so make sure that they are placed close to the actual mirror area.

Unboard Location

As the name implies it marks the position where a player will be when they leave the cockpit. We normally place it in the area next to the driver door.

Minimap Representation

For the minimap we render a reduced version of the game world, where we show routes, busses, bus stops and certain points of interest. Each of these actors need a representation in the game world which will automatically be hidden while playing.

You can show and hide the representation in the blueprint editor by toggling the Show Representation flag.

Movegraph Setup

To tell the passengers where they can move in the bus and where they can sit and stand you need to setup a movegraph in the bus which leads from the doors to the seats and standing positions.
If you click on the PassengerMoveGraph component in one of the presetup buses, you can see the node network of a completed bus.

 

Move Graph Component
Visualization of the movegraph

Move Nodes

There are two types of nodes you can place in the bus to mark specific positions in the bus.

Passenger Move Root Node

The root nodes are used as entry points to the bus and are placed at the bus doors.

Setting

Explanation

Associated Door

Marks the door which should be checked to see if a passenger can board via this node. Doors are numbered from front to back starting at 0

Node ID

Used to identify move nodes. Make sure they are unique in the move graph network of your bus.

Bone Name

Used to identify which bone the nodes should follow when the bus moves. Especially useful for bendy buses as nodes in the rear part should follow the rear part movement.

Root node settings

Passenger Move Node

The Passenger Move Nodes are used to mark walkways, standing and sitting positions.

Setting

Explanation

Node ID

Used to identify move nodes. Make sure they are unique in the move graph network of your bus.

Bone Name

Used to identify which bone the nodes should follow when the bus moves. Especially useful for bendy buses as nodes in the rear part should follow the rear part movement.

Node Type

Used to mark if a passenger can sit or stand at the node and if it is a wheelchair spot. Depending on node type you should see different passenger representation to make the placement easier. (Visualisation still needs to be implemented)

Passenger node settings

Connecting the nodes to create the move graph

After you placed all move nodes and root nodes make sure that there are no duplicate Node IDs in you network, as it will cause issues if two nodes have the same ID when you connect them.

  1. You should now see many unconnected nodes if you select the PassengerMoveGraph component in the Components window

  2. Select 2 or more nodes you want to connect by holding CTRL and left click on the squares. You should see the selected nodes highlighted in yellow.

  3. Right click the node you want to connect to all other selected nodes and select “Make Neighbor”

  4. You should now see connections from the right clicked node to all selected nodes.

  5. Repeat this until you are happy with how the graph locks and all nodes are accessible.

If some connections are not to your liking, select the nodes where you want to break the connection right click a selected node and click “Disconnect Nodes”.

Click the PassengerMoveGraph component to see all nodes
CTRL+Left click to select multiple nodes
Right click to connect neighbors
Connected neighbors

License plate

The license plates are spawned at the License Plate Back and License Plate Front position, move them to the correct spot.

 

 

Ramp component

Place the ramp to the door that should have it, the component will automatically search for the closest door to attach itself to.

 

 

 

Combining meshes

A bus will have lots of smaller clutter objects, e.g. stickers, emergency hammers,… , moving them separately while the bus moves can lead to performance issues. This can be alleviated by combining all these small clutter objects into one bigger mesh.

If your bus doesn’t have one yet, add a “CombinedMesh” Component to your bus.

Set the “Affected Tag” variable to a value of your choice. Add this tag to all clutter objects you would like to combine. Make sure to check the Is Editor Only flag on all objects with the tag.

The combined mesh will be recreated whenever you save your bus blue print.

A bendy bus will need two combined mesh components with two different tags, one for the front of the bus one for the back.

 

Rainblocker

Add a RainBlocker Component to your bus. This will prevent rain from falling inside your bus. Scale the box to the approximated size of the bus. Make sure to set its mobility to movable, otherwise it will not follow the bus correctly.

A bendy bus will need two rain blockers one for the front and one for the back.

LODs

For performance reasons it is recommended to create LODs for your bus. To do that open the skeletal mesh for your bus. Scroll down in the asset details until you find LOD settings. We normally create 3 LODs for our buses, check the provided buses for reference on the LOD settings. Depending on your bus you might need to play a little with the LOD distances to find good transition points.

Next Steps

Setup Dashboard

Bendy Bus Setup