Skip to content
CRUSHFORMV1.1.0
GET IT ON FAB

DAMAGEDENTS AND THE LATTICE

Dents and the lattice

A hard enough hit pushes the body’s metal in, and the dent stays until it is repaired. One data asset, the profile, sets the shape of every dent. This page goes through the settings that shape a dent and the ways to repair the body. The lattice that holds the dent, the atlas that draws it and the path from a physics contact to a hit are in Core concepts. Read that first if the words are new.

A panel that takes a hit caves in where the hit lands. The metal crumples the way sheet metal does: the dent runs back from the contact like an accordion, spreads across the hit and gets deeper as the hit gets harder, up to a limit. A soft touch leaves the body alone.

A debug hit caves the side in. The dent stays until the body is repaired.

Paint wears in the same places. See Paint and scratches.

  • The hit. A hit is the speed the body loses along the contact normal, in m/s. The body dents only when the hit is faster than Min Delta V (UCFProfile::MinDeltaV, 0.5 m/s). A slower contact makes no dent.
  • The depth. One hit digs Stiffness (UCFProfile::Stiffness, 3 cm per m/s) for every m/s above Min Delta V, to at most Max Dent Per Hit (UCFProfile::MaxDentPerHit, 20 cm). At the defaults a 15 m/s hit asks for 43.5 cm and gets 20 cm. The cap keeps one hit well under Max Displacement, so repeated hits still go deeper.
  • The width. The dent’s radius is Base Radius (UCFProfile::BaseRadius, 30 cm) plus Radius Per Delta V (1.5 cm per m/s) times the hit’s speed. It is never smaller than 1.25 lattice cells. Lateral Scale (1.5) widens it across the hit. Wide, short dents read as crumpled metal; narrow, round ones read as rubber.
  • The fold. A hit on one point, such as a post, crumples the metal behind the contact. Crumple Ratio (3) sets how far, as a multiple of the dent’s depth. A hit that spreads over a flat patch, such as a wall, presses the face flat instead.
  • The ragged edge. Noise Amount (0.3) takes a little depth off each node at random, so a hard crash leaves ragged metal, not a flat plate. Drag Fraction (0.3) pulls the dent along the surface when the hit slides.
  • The limit. No node moves past Max Displacement (UCFProfile::MaxDisplacement, 60 cm). The body’s materials must use the same number as their displacement bound. Core concepts covers that wiring.
  • Repair. UCFDeformComponent::Repair clears every dent and scratch on every machine and puts hinged parts and glass back. It works only on the server (the authority), and the other machines follow. Dirt stays. Wash removes the dirt.
  • Automatic repair. Auto Repair Delay (UCFSettings::AutoRepairDelay) repairs a body that many seconds after its latest damage. It is 0 by default, which means never.

These steps make the dent profile. The vehicle setup is the same as in Quick start.

  1. In the Content Browser, choose Add > Miscellaneous > Data Asset, pick CFProfile and name the asset in your project.
  2. Open the profile. Keep Dents on and start from the defaults in the table below. Resolution under Lattice is the number of lattice nodes on each axis. Every axis must be a multiple of 4, and the asset’s validation warns when the lattice does not fit one atlas slot.
Lattice
Resolution1688
Lattice Margin10.0
Use Explicit Bounds
Explicit Bounds
Min Radius in Cells1.25
Components
Include Tags0 Array element
Exclude Tags0 Array element
Dents
Dents
Deform Collision
Hinged Parts
Dented Part Collision
Min Delta V0.5
Stiffness3.0
Max Dent Per Hit20.0
Base Radius30.0
Radius Per Delta V1.5
Lateral Scale1.5
Crumple Ratio3.0
Drag Fraction0.3
Noise Amount0.3
Bulge0.5
Bulge Down Share0.3
Max Displacement60.0
Stiffness Zones0 Array element
The Lattice, Components and Dents groups of a dent profile, with their default values.
  1. Give the body the profile. A vehicle adapter makes the deform component for you: select the adapter and set Deform Profile. Your own actor takes a CFDeform from Add, in the Crushform group, with Profile set to the asset. Without a profile the component does nothing.
  2. Wire the body’s materials as in Quick start, step 1. A mesh whose material is not wired does not move.

A Blueprint repairs a body with one call, Repair. The graph below runs when the custom event RepairCar fires. It gets the deform component the sedan’s adapter holds, with Get Deform, and calls Repair on it.

The graph runs when the custom event RepairCar fires and calls Repair on the deform component.

From C++, a hit that physics did not report, such as a prop the body broke without touching it, goes in with ApplyWorldHit:

// A 12 m/s hit where the prop stood. Only the machine that simulates the body applies it.
const FVector PropLocation = Prop->GetActorLocation();
const bool bApplied = Deform->ApplyWorldHit(PropLocation, FVector::UpVector, 12.0f);

ApplyWorldHit returns false when the point lies outside the lattice, when the hit is too soft to dent, or when this machine may not apply hits to the body.

PropertyWhat it doesDefault
UCFProfile::bDentsOff: hits and crush presses never dent or scratch the body. Dirt still works.On
UCFProfile::MinDeltaVSpeed change, m/s, below which a hit makes no dent.0.5
UCFProfile::StiffnessDent depth, cm, per m/s above Min Delta V.3
UCFProfile::MaxDentPerHitDeepest one hit can dent, cm, where the zone’s stiffness is 1.20
UCFProfile::BaseRadiusDent radius at zero speed, cm.30
UCFProfile::RadiusPerDeltaVRadius added per m/s of the hit, cm.1.5
UCFProfile::LateralScaleWidens the dent across the hit.1.5
UCFProfile::CrumpleRatioHow far a point hit crumples the metal, as a multiple of its depth.3
UCFProfile::NoiseAmountRandom share of a point hit’s depth taken off each node, up to 0.9.0.3
UCFProfile::MaxDisplacementFurthest any node moves, cm. Body materials use it as their displacement bound.60
UCFSettings::AutoRepairDelaySeconds after the latest damage before the body repairs itself. 0 never.0

Open the proving ground in Play In Editor. The command skips the car you drive, so the target is a second car: put a car set up with the profile above in view, and note its name as the World Outliner shows it.

  1. Type Crushform.DebugImpact 15 <car name>, with that car’s name in place of <car name>. It hits the named car at 15 m/s from where you stand, and the log says it is now damaged.
  2. Type Crushform.Debug 2. The lattice shows as nodes and beams. Each recent hit leaves a blue sphere with a normal arrow for a few seconds.
  3. Type Crushform.RepairAll. The log reports how many bodies it repaired, and the dents go.

Crushform.Debug, Crushform.DebugImpact and Crushform.RepairAll are cheats: they work in every build except Shipping, and in the editor.

Cause. The speed change is at or under Min Delta V. A hit dents only above it.

Fix. Lower Min Delta V, or hit harder. To check the body itself, run Crushform.DebugImpact 15 <car name> at it (see Check that it works). If that dents the body, the game hit was too soft.

Cause. Max Dent Per Hit caps one hit at 20 cm by default. A harder hit does not dig deeper than the cap.

Fix. Raise Max Dent Per Hit, keeping it well under Max Displacement so that repeated hits still go deeper.

Cause. Auto Repair Delay is above 0. The body repairs that many seconds after its latest damage.

Fix. Set Auto Repair Delay to 0 in Project Settings > Plugins > Crushform, under Repair, or to the delay you want.

Cause. The profile’s Include Tags and Exclude Tags filter the meshes that bend. A mesh with an excluded tag never dents, and a part that moves relative to the body must be excluded.

Fix. Check the component tags of the panel and the two lists in the profile.