Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

REFERENCECOMPONENTS

UCFTireComponent

MODULECrushformTireINCLUDECFTireComponent.hPARENTUActorComponent

One per vehicle. Tracks the vehicle's wheels, owns the deformer of each wheel the budget grants, and ticks them after the host has placed the wheel meshes. The owner implements ICFTireHost.

Functions

AUTHORITY · server, every machineLOCAL · this machinePURE · read only
void SetProfile(UCFTireProfile* InProfile)
C++ ONLY

Sets the tyre profile. Set after BeginPlay, a profile also puts a component that began play without one into the subsystem's budget.

UCFTireProfile* GetProfile() const
PUREC++ ONLY

The tyre profile, or null.

void SetCrushformHost(UObject* NewHost)
C++ ONLY

Who answers ICFTireHost for this component; null = the registry's host for the owner, else the owner. Call before BeginPlay: the component reads its wheels from the host once, until ForgetWheels.

UObject* GetCrushformHost() const
PUREC++ ONLY

The explicit host, else UCFHostRegistry::FindHost(Owner, UCFTireHost), else null.

void ResolveWheels()
C++ ONLY

Reads the host's wheels once, the first time it reports any, and lowers each tyre so it rests on the ground. The host may build its wheel meshes after BeginPlay, so the caller asks again until the list is no longer empty.

void ForgetWheels()
C++ ONLY

Puts every wheel back the way the host had it (no deformer, the host's own offset, the mesh's own render state) and forgets the list, so the next ResolveWheels reads the host's wheels again. A host whose wheel set changes calls it BEFORE it replaces its list: the offsets go back through the host by each wheel's index in the list it still has. Never call it from inside a host callback this component issued (GatherLoadRatios during the load update walks Wheels, which this empties).

const TArray<FCFTireWheel>& GetWheels() const
PUREC++ ONLY

The wheels read from the host; empty until ResolveWheels has found any.

float FindRimRadiusInMaterials(TConstArrayView<const UMaterialInterface*> Materials)
C++ ONLY

The rim radius, mesh units, from the scalar RimRadius of a tyre's materials; 0 when none has one. The first material that sets RimRadius itself wins. Failing that, the first material that has it supplies its inherited default, so a rim material on the same master does not hide the tyre's own value. Null materials are skipped.

void GrantWheel(int32 WheelIndex, uint8 Tier)
C++ ONLY

Gives the wheel a deformer at the tier's trace density, or moves an existing one to that tier and turns its tracing back on.

void RevokeWheel(int32 WheelIndex)
C++ ONLY

The wheel leaves the budget: its deformer stops tracing and the dent fades out. The deformer stays until DestroyRelaxedDeformers finds it relaxed, so the tyre does not pop back to round.

int32 DestroyRelaxedDeformers()
C++ ONLY

Removes the fading deformers whose dent is gone; returns how many wheels are still fading. Switches the tick off when no deformer is left.

FCFTireDeformer* FindDeformer(int32 WheelIndex)
C++ ONLY

The wheel's deformer, or null when it has none. The pointer is good until the wheels are resolved again or the deformer is removed.

void SetDrawDebug(bool bInDrawDebug)
C++ ONLY

Draws the rays and contacts of every deformer.

void SetRestingSink(bool bInRestingSink)
C++ ONLY

Off: a wheel with no deformer rests on the ground instead of sinking by the resting deflection. A wheel that still carries a deformer stays sunk.

void UpdateLoadSink(float DeltaTime)
C++ ONLY

Moves each deformed wheel's load factor toward what the host reports and re-applies its offset once that has moved it noticeably.

float StepLoadFactor(float CurrentFactor, float LoadRatio, const UCFTireProfile& Profile, float DeltaTime)
C++ ONLY

One smoothing step of a wheel's load factor. The target is 1 + LoadSensitivity * (LoadRatio - 1), kept within [0, MaxLoadFactor]; the factor rises over LoadAttackTime and falls over LoadReleaseTime. LoadRatio is the host's contact force over nominal load.

Properties

TObjectPtr<UCFTireProfile> Profile

The tyre profile that tunes the deformation. Without one the vehicle's tyres stay round.

Category
Tire Deformation