Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

VEHICLEVEHICLE ADAPTER

Vehicle adapter

The Crushform Vehicle Adapter puts the plugin on an actor with wheels. Add it once and list the wheels. It then creates the dents and dirt, the glass, the tyres, the rolling sound and effects, the engine sound, the prop breaking and the impact feedback, and answers the plugin’s questions about the vehicle. Use it for a wheeled actor that is not a Chaos vehicle, such as a trailer. A Chaos vehicle takes the Chaos adapter, which reads its wheels from the movement component.

The adapter is one component on the actor. It answers the plugin’s questions about the vehicle, and it creates the plugin’s components under fixed names on every machine. Each component has its own switch, listed under Key settings below. Quick start shows the components one by one.

The wheels come from the Wheels list, or from SetWheels during the game. Each frame the adapter traces the ground under each wheel. The trace starts at the hub and ends at the tyre radius plus Ground Probe Margin, so a tyre that is a little above the ground still touches it. A wheel’s speed comes from how its component moved since the last frame, so a towed trailer has wheel speed without an engine. The dust a wheel throws comes from that speed.

Authority decides which machine simulates the vehicle and judges its hits:

  • Server is the default. The server simulates the vehicle and refuses hit reports from clients.
  • Owning Client makes the machine that controls the vehicle the source of its hits. The server does this while no player controls the vehicle. The server accepts a reported hit only when its speed change is no more than the vehicle’s recent peak speed plus Ram Allowance Mps, scaled up for a lighter body that gives way.

On a dedicated server the adapter traces no wheels, because nothing there shows them.

A tyre that presses onto an obstacle would let its rim enter it. The adapter moves the whole wheel away from the obstacle by the push the tyre asks for, so the tyre dents around the obstacle and the rim stays outside it. The push is limited by UCFTireProfile::MaxPush; past it the rim may enter the obstacle. A tyre whose contacts are all shallower than its rubber allows is not pushed.

The push is converted to the wheel’s parent space once, when it arrives. For a wheel whose parent turns against the car, such as a steering knuckle, the push is wrong while the parent turns. The host interfaces guide shows how to turn the push off for that wheel.

A Blueprint that overrides Set Crushform Tire Wheel Offsets places the wheels itself and gets no push. The tyre then dents as it would without a push, down to its Max Deflection, and its rim may enter the obstacle.

A trailer is an actor with wheel meshes and no movement component. List its wheels in Wheels. The adapter takes each wheel’s speed from how the wheel moved since the last frame, so the rolling sound, the rolling effects and the dust work while the trailer is towed, with no engine in it.

The per-vehicle values (the impact thresholds, the prop speed, the rolling and engine tunings and the cabin values) are copied onto the components when the adapter registers. A change made later in a running game reaches none of them.

The steps for the adapter itself are the same as on your own vehicle, so follow them there. The trailer case needs only these differences.

  1. Add the adapter and list the wheels as in Your own vehicle, under With the Crushform Vehicle Adapter. The steps are not repeated here.
Crushform
Wheels
Wheels4 Array elements
Index [ 0 ]SM_Wheel_Front_L
WheelSM_Wheel_Front_L
Radius0.0 cm
Index [ 1 ]SM_Wheel_Front_R
WheelSM_Wheel_Front_R
Radius0.0 cm
Index [ 2 ]SM_Wheel_Rear_L
WheelSM_Wheel_Rear_L
Radius0.0 cm
Index [ 3 ]SM_Wheel_Rear_R
WheelSM_Wheel_Rear_R
Radius0.0 cm
Ground ChannelVisibility
Ground Probe Margin2.0 cm
The Wheels list of the Crushform Vehicle Adapter, with four wheels.
  1. A trailer has no movement component, so the Wheels list is its only wheel setup. For each wheel, open its entry and pick the wheel’s component in Wheel: the list shows the scene components of the Blueprint, so nothing is typed. Set Radius on any wheel whose mesh has no bounds, as described in the Key settings table below (0 takes half the height of the mesh’s bounds).
  2. Check Authority and the feature switches there too. Every switch is on by default.
Crushform
AuthorityServer
Deform ProfileDA_CF_DefaultProfile
Tire ProfileDA_CF_DefaultTireProfile
Ram Allowance Mps15.0 m/s
Features
Dirt and Dents
Glass
Tires
Rolling Sound
Rolling FX
Engine Sound
Impact Feedback
Breaks Props
The Crushform category of the Crushform Vehicle Adapter. All feature switches are on.

On a Blueprint, the calls that tell the adapter what the vehicle does are described in Your own vehicle, under Tell the adapter what the vehicle does. The graph shows SetBraking and SetCabinMuffled on CF_Adapter:

The graph shows SetBraking and SetCabinMuffled on CF_Adapter.

The same calls in C++. Get the adapter from the actor, then call the functions. Each signature is the one in the adapter’s header. The Crushform modules you call must be in your Build.cs, as in Installation.

#include "CFVehicleAdapterComponent.h"
void AMyVehicle::Tick(float DeltaSeconds)
{
Super::Tick(DeltaSeconds);
if (UCFVehicleAdapterComponent* Adapter = FindComponentByClass<UCFVehicleAdapterComponent>())
{
Adapter->SetBraking(BrakeInput);
Adapter->SetCabinMuffled(bListenerInCabin);
// The front side's deepest dent, 0 untouched to 1: the damage the server has confirmed.
const float FrontMaxDent = Adapter->GetDamageZones().Front.Max;
}
}

To read the damage on a box of the vehicle instead of a side, call GetDamageInBox with an FBox in the owner’s root space.

Each row is a property of UCFVehicleAdapterComponent unless it names another type. The labels in bold are the switches’ labels in the Details panel. Values are the defaults in the code.

PropertyWhat it doesDefault
UCFVehicleAdapterComponent::AuthorityWhich machine simulates the vehicle and judges its hits. Server: the server does, and refuses client reports. Owning Client: the machine that drives it does, and reports its hits.Server
UCFVehicleAdapterComponent::DeformProfileThe dents and dirt of the body. Empty takes the default in Project Settings, under Crushform.empty
UCFVehicleAdapterComponent::TireProfileThe tyres. Empty takes the default in Project Settings, under Crushform Tire.empty
UCFVehicleAdapterComponent::bDirtAndDentsDirt and Dents: the body dents and gets dirty. The glass panes and the wheels’ dirt need it.on
UCFVehicleAdapterComponent::bGlassGlass: the panes crack and break. Needs Dirt and Dents, which finds the panes.on
UCFVehicleAdapterComponent::bTiresTires: the tyres deform on the wheel meshes.on
UCFVehicleAdapterComponent::bRollingSoundRolling Sound: each wheel plays its surface’s rolling sound. Silent on a dedicated server.on
UCFVehicleAdapterComponent::bRollingFXRolling FX: each wheel shows its surface’s rolling effect. None on a dedicated server.on
UCFVehicleAdapterComponent::bEngineSoundEngine Sound: the engine plays its sound. Also needs the engine sound switch in Crushform Engine.on
UCFVehicleAdapterComponent::bImpactFeedbackImpact Feedback: hits play impact sounds and effects on every machine. With Dirt and Dents, the hinged parts’ hits play too.on
UCFVehicleAdapterComponent::bBreaksPropsBreaks Props: the vehicle breaks the breakable props it drives into.on
UCFVehicleAdapterComponent::WheelsThe wheels the adapter traces, one FCFAdapterWheel each. Replaced at runtime by SetWheels.empty
FCFAdapterWheel::WheelThe wheel’s component, a mesh or a scene component that turns with the wheel.none
FCFAdapterWheel::RadiusThe tyre radius in centimetres. 0 takes half the height of the wheel mesh’s bounds, when the list is first used.0 cm
UCFVehicleAdapterComponent::GroundChannelThe channel the wheels trace the ground on.Visibility
UCFVehicleAdapterComponent::GroundProbeMarginHow far above the ground a tyre still touches it, in centimetres.2 cm
UCFVehicleAdapterComponent::ImpactEventTagThe tag of the impact a crash plays. Empty plays no impact sound.Crushform.Impact.Vehicle.Crash
UCFVehicleAdapterComponent::ImpactImpulsePerKgForFullIntensityThe velocity change, in cm/s, that plays at full strength.600 cm/s
UCFVehicleAdapterComponent::ImpactMinImpulsePerKgThe velocity change, in cm/s, below which a hit plays nothing.50 cm/s
UCFVehicleAdapterComponent::PropContactMinSpeedCmSBelow this speed the vehicle breaks no props, in cm/s.50 cm/s
UCFVehicleAdapterComponent::bOverrideRollingSoundTuningUse RollingSoundTuning for this vehicle instead of the Crushform Wheels settings.off
UCFVehicleAdapterComponent::bOverrideRollingFXTuningUse RollingFXTuning for this vehicle instead of the Crushform Wheels settings.off
UCFVehicleAdapterComponent::bOverrideCabinMufflingUse this vehicle’s CabinVolumeScale and CabinLowPassFrequency in SetCabinMuffled, not the settings’.off
UCFVehicleAdapterComponent::CabinVolumeScaleThe volume of the rolling and engine sound from inside the cabin, when the override is on.0.8
UCFVehicleAdapterComponent::CabinLowPassFrequencyThe low-pass cutoff of the sound from inside the cabin, in Hz, when the override is on.3000 Hz
UCFVehicleAdapterComponent::EngineSoundProfileThe engine’s sound. Empty takes the default in Crushform Engine.empty
UCFVehicleAdapterComponent::EngineSoundOffsetWhere the engine sound plays, relative to the owner’s root, in centimetres.zero
UCFVehicleAdapterComponent::RamAllowanceMpsWith Owning Client: how much faster, in m/s, than the recent peak speed a reported hit may be.15 m/s

For the Chaos adapter, which takes its wheels from the movement component, see the Chaos adapter page.

  1. Press Play, drive the vehicle into a wall, then open the console.
  2. Run Crushform.Stats. It prints one line per body the plugin dents. The line for your vehicle shows a hits count above 0 after the crash.
  3. Run stat CrushformVehicle. The Vehicle adapter time appears while the vehicle moves.

The console commands are in every build except Shipping, and in the editor.

The glass never cracks, and there is no CF_Glass component

Section titled “The glass never cracks, and there is no CF_Glass component”

Cause: Glass needs Dirt and Dents. The adapter makes the glass component only when both are on.

Fix: Turn on Dirt and Dents, then recompile and play again.

Nothing dents, and OnDamageChanged never fires

Section titled “Nothing dents, and OnDamageChanged never fires”

Cause: Dirt and Dents is off. Without it the adapter makes no CF_Deform component, so the damage is always zero and the event never fires.

Fix: Turn on Dirt and Dents. Check the Deform Profile too: empty takes the project default.

Cause: Authority is Server, which refuses every hit report from a client.

Fix: Set Authority to Owning Client for a vehicle the player drives. Keep Server for a vehicle that the server simulates alone.

A wheel is skipped, and the log says it has no radius or names no scene component

Section titled “A wheel is skipped, and the log says it has no radius or names no scene component”

Cause: The wheel’s Radius is 0 and its mesh has no bounds to take one from, or its Wheel entry names no component.

Fix: Set Radius in centimetres, and pick the wheel’s component in Wheel.

Changing the engine sound offset or the impact thresholds in a running game does nothing

Section titled “Changing the engine sound offset or the impact thresholds in a running game does nothing”

Cause: The adapter copies these values onto its components when it creates them. A change on a running vehicle reaches none of them.

Fix: Set the value before the vehicle spawns, or on the Blueprint’s defaults, then spawn a new vehicle.