How the physics works
All the vehicle physics is in js/physics.js. Units are SI throughout. Car-local axes are x forward, y up, z right, with the ground at y = 0. The rigid barrier's face is at x = 0, and the car approaches from −x.
1. The vehicle as a lattice
Each car is a 3D grid of point masses (nodes) joined by springs (distance constraints), fitted to the car's body:
- The grid. Columns run along the car, placed so both axles fall on columns: about 24 cm apart for the imported cars, uniform for the Lab sedan. There are about 29 cm between rows and about 22 cm across the car. Nodes more than one row above the body's roof profile are dropped. The row just above the surface becomes light ghost nodes (0.25 kg) that only carry the render mesh.
The springs. Every node connects to 13 neighbours: 3 along the axes, 6 face diagonals and 4 body diagonals, each pair once. The diagonals give the lattice shear and bending stiffness.
Vehicle Nodes (ghost) Springs Lab sedan 672 (96) 6,506 Lexus RX 350 999 (144) 9,913 Ford Mustang GT500 774 (144) 7,563 Side-impact barrier trolley 480 4,490
- Mass. The curb mass is spread over the structural nodes. 12% sits on the engine block's nodes, and 20 kg per corner sits on the wheel nodes (imported cars).
Zones. Spring stiffness and yield strain are multiples of a base stiffness K₀ = 1.1 MN/m (scaled with the lattice spacing, so the material stays as stiff) and a base yield strain ε_y = 1.15%:
Zone Stiffness Yield strain Front crumple zone (ahead of the firewall) 1× (× the Soft/Standard/Stiff setting) 1× Engine block (inside the crumple zone) 2.5× 2.5× Passenger safety cell 2.5× 2.4× Rear structure 1.5× 1.2× Ghost springs 0.15× 1× The zones are placed relative to each car's H-point (the driver's hip point) and rear axle, so every car gets a crumple zone, an engine, a cabin and a rear of the right size.
2. The solver: XPBD with plastic flow
The structure is integrated with XPBD, extended position-based dynamics (Macklin, Müller & Chentanez, 2016). It uses many small substeps, each with one constraint pass ("small steps" XPBD), which keeps stiff springs stable without a global solve. Each substep:
- Predict. Save each node's position x*, add gravity to its velocity, move it: x ← x + v·Δt.
Project the springs. For each spring between nodes a and b, with inverse masses w, rest length L₀ and compliance α = 1/k:
C = |x_b − x_a| − L₀ (constraint: stretch of the spring) γ = (c · α) / Δt (damping weight; c = 2ζ·√(k·m_reduced), ζ = 0.08) ẋ_rel = relative displacement along the spring this substep Δλ = −(C + γ·ẋ_rel) / ((1 + γ)(w_a + w_b) + α/Δt²) x_a −= w_a·Δλ·n, x_b += w_b·Δλ·n (n: unit vector from a to b)Stiffness is physical. A spring of stiffness k behaves like one, independent of the step size, and each spring carries 8% of critical damping.
- Plastic yield. If the spring's elastic strain after the correction exceeds its yield strain, the excess flows plastically: the rest length moves. The steel stays bent instead of springing back. The work done, yield force × plastic flow, is booked as plastic deformation energy, and the accumulated plastic strain is stored per spring. Rest lengths are clamped to 0.25–1.8× their original length, which models crushed structure bottoming out.
- Contacts. Penetrating nodes are pushed out (next section).
- Friction. Coulomb friction at every contact. The kinetic energy it removes, net of what went into springs and height, is booked as friction heat.
- Velocities. v = (x − x*) / Δt, then a velocity pass for contacts with rigid bodies.
Time step. 0.1 ms from the start and for 0.3 s after first contact, while the crash pulse runs. Then 0.5 ms for the rebound and debris settling. 1 ms gains energy with the stiff mortar bonds, so it isn't used.
Duration. The barrier tests continue 1.2–2.4 s after first contact, depending on the car and barrier, so parts and bricks land.
3. Contacts and friction
Every structural node is a sphere of radius 12 cm. Contacts with bricks, debris and the lab obstacles cancel the node's approach in that substep but never push it apart faster than 1 m/s, so deep penetrations can't pump energy in.
| Contact | How |
|---|---|
| Ground | Nodes stay above their floor height. Wheel nodes ride at hub height, so the tyre carries the car: friction 0.8 sideways, rolling resistance 0.015. |
| Rigid barrier | A concrete block (18 m wide, 3 m tall) with its face at x = 0, friction 0.3. The normal forces are summed like a load-cell wall. |
| Brick wall | Bricks are rigid boxes found through a spatial hash. Contacts are solved between the node and the brick's closest surface point, with the brick's own generalised mass and rotation. |
| Offset barrier, pole | A signed-distance function: a block with a 150 mm rounded edge (small-overlap test), or a 254 mm cylinder. |
| Honeycomb face | A 5 cm grid of aluminium cells in front of the offset barrier. A node presses on the cells under its share of the lattice face. Below their crush stress (0.34 MPa, or 1.7 MPa in the front strip) they stop it; above it they crush at constant force and bottom out when nearly flat. A cell's crush per step is capped at the node's forward advance, so sideways sliding can't crush it. The crush work is a separate energy channel. |
| Vehicle against vehicle | All cars' lattices run in one solver. Nodes of different cars meet as spheres, found through a spatial hash of the overlap of their bounding boxes, with friction 0.4. Crushed fronts interlock, so these contacts only cancel approach (at most 2 cm/s of separation); pushing nodes apart would pump energy in. |
| Debris | Parts and wheels that came off are rigid bodies with contact points on their outline, colliding with the ground, barrier and bricks. |
4. The brick wall
The wall has 366 bricks (40 × 20 × 25 cm, 2,000 kg/m³) in 12 courses, between two concrete pillars. Each brick is a rigid body: position, quaternion, linear and angular velocity, and the gyroscopic term for free spin.
- Mortar. Each joint is two bond points, so a joint carries bending as well as tension and shear. A bond is a stiff XPBD point constraint (compliance 2×10⁻⁸ m/N).
- Failure. A bond breaks in tension or shear above the mortar strength: weak 8 kN, standard 30 kN, strong 120 kN. Compression raises the shear capacity (Coulomb, factor 0.6). The energy stored in a breaking bond is booked as fracture energy.
- Sleeping. Bricks are dormant until loaded and go back to sleep when still. Bricks cut off from the footing and pillars lose their support and fall, singly or as clusters.
5. Destruction
Imported cars are split into named parts: bumpers, hood, fenders, doors, trunk or tailgate, mirrors, glass panes, lamps and wheels.
Panels ride on the lattice until the springs they're mounted on have yielded far enough (mean plastic strain), then come off as rigid debris that keeps its crushed shape.
Part Mass Comes off at (mean plastic strain of its mounts) Front / rear bumper 9 / 7 kg 16.5% / 15% Hood 15 kg 25% Fender 4 kg 18% Front / rear door 24 / 20 kg 6% Trunk or tailgate 14 kg 15% Mirror 1.5 kg 5%, or when it hits something Dramatic damage multiplies every limit by 0.3.
- Conservation at the break. A debris body's mass is taken out of the nodes it sat on. Its velocity comes from their momentum. Its angular velocity is I⁻¹L, clamped so kinetic energy can't rise; the kinetic energy given up is booked as fracture energy. The headless check fails if a break changes total momentum or energy.
- Wheels are lattice nodes until their mount yields (30% mean plastic strain) or the hub is shoved back 45 cm; then they come off as rigid wheels spinning at their rolling speed. A tyre bursts when the rim meets an obstacle or the hub is shoved back 20 cm. It then goes flat over 50 ms, keeping 25% of its sidewall height, and its rolling resistance rises.
Glass and lamps are decided after the run, from the recorded strain of the structure around each pane:
- tempered side and rear windows break at 6% mean plastic strain;
- the roof glass at 12%;
- lamps at 10%;
- any pane or lamp breaks when it touches the barrier or a brick, or when its panel comes off.
Tempered glass bursts into a few hundred shards. The laminated windshield stays in and cracks instead, at 2.5% or where the dummy's head hits it.
6. Measuring the crash
- The cabin frame. Its origin is the mass-weighted centre of the passenger-cell nodes; forward runs from the rear to the front cabin nodes, and up from the floor to the roof nodes. The dummy rides in this frame.
- The crash pulse. The cabin velocity is resampled onto a uniform 0.1 ms grid, differentiated and filtered with an SAE J211 CFC 60 filter (a phaseless 4-pole Butterworth). It gives the deceleration, Δv, peak g and time to stop.
- Crush and intrusion. Crush is how far the front face has moved back relative to the cabin (mean of the front column). Cabin intrusion is how far the dash has moved toward the seat.
- Lab measurement points. Steering column, brake pedal, toe pan, hinge pillar, B-pillar and door points are embedded in the lattice. They are measured in a frame fitted (least squares, polar decomposition) to the undamaged rear corner of the cabin, so the car's own rotation doesn't count as intrusion.
- Energy. The books hold: car and debris kinetic energy (with wheel spin), elastic, plastic, fracture, friction, gravity and honeycomb crush. Position-based dynamics can't attribute contact, structural damping and numerical losses separately, so they form one residual channel, "contact, damping & solver". The energy chart shows where the initial ½mv² went.
7. The approach
js/guidance.js drives the car on a kinematic bicycle model:
- a PID speed controller sets the drive or brake force;
- pure-pursuit steering follows the approach line through the barrier centre at the chosen angle.
The car starts 30–130 m back (3 s at the test speed), 0.6 m off the line with a 4° heading error, so the controllers have something to correct. The impact simulation takes over when the gap is 1 cm plus 4 ms of travel, with the car's exact pose, speed and yaw rate.
8. After the crash: steam and fire
js/fire.js decides from the recorded crash:
- Steam. The front was crushed back to the radiator (25 cm behind the front, or the front of the engine if that's nearer). Hot coolant vents as steam.
- Engine-bay fire. The engine block, measured as the mean of its lattice nodes in the cabin frame, was driven 30 cm or more back toward the firewall. That crushes the fuel rail and the fuel and oil lines against the hot exhaust at the back of the engine.
The fire grows in stages:
- smoke starts at once (0.3 s);
- flames after about a second;
- well alight after about 9 s, with burning fluid spreading under the car.
With the Lexus into the rigid barrier:
- 56 km/h pushes the engine back about 10 cm: steam only;
- 80, 100 and 130 km/h push it back about 43–50 cm: fire.
Rear impacts, which cause most fuel-tank fires, aren't simulated, so there is no fuel-tank rule.
9. The GPU solver (optional)
js/gpu-lattice.js runs the car lattice on the graphics card with WebGPU compute shaders (WGSL). Choose GPU under Physics solver in the free simulator or a lab, or add ?solver=gpu to the URL.
What it covers. The rigid barrier, the offset barrier with or without its honeycomb face, the pole (with the low-friction carrier), and several vehicles crashing into each other: every crash the labs set up. The brick wall isn't covered, so the free simulator's brick-wall runs stay on the CPU. In GPU runs parts don't come off and tyres don't burst, because detaching a part changes the lattice and that bookkeeping stays on the CPU. If the GPU can't take a set-up, the CPU solves it and the results say why.
- The same equations. Each step runs predict, the XPBD springs with damping and plastic yield (same formulas and limits as section 2), the contacts (section 3), Coulomb friction, then velocities.
- A different order. The CPU projects the springs one after the other (Gauss-Seidel). On the GPU they are split by greedy colouring into groups where no two springs share a node: 27–28 groups for these cars. Each group is projected in parallel and the groups run one after the other. It is the same method in a different order.
- Car against car. Each node checks every node of the other cars, tiled through the GPU's workgroup memory. Its share of each correction comes from the same positions (Jacobi), rather than the contacts being solved one after the other. The contacts are kept per node for friction.
- Honeycomb. One thread per lane of nodes (one behind the other at the same height and side position) crushes the cells in the CPU's order. Cells are claimed atomically, so a cell still counts toward one node per step.
- 32-bit floats. The GPU uses 32-bit floats, the CPU 64-bit. The car sits near the barrier at x = 0, so positions keep sub-micrometre resolution.
- Batches. The steps run in batches, one recorded frame's worth each (1 ms during the pulse, up to 10 ms later). After each batch the state is read back: positions, velocities, rest lengths, plastic strain and work, contact impulses (for the barrier's load cell, each car's contact force and the events), the honeycomb's crush and crush work, and the step of first contact. The CPU then records the frame, telemetry and energies with the same code as for its own runs.
- Energy books. Friction heat isn't tracked on the GPU, so it is counted in the "contact, damping & solver" share.
node tools/gpu-check.js runs the same crashes with both solvers in headless Chrome. These are crashes in which nothing comes off on the CPU either. Results on an AMD RDNA 3 GPU:
| Crash | Crush | Peak (CFC 60) | Δv | Plastic energy | Time: CPU / GPU |
|---|---|---|---|---|---|
| Lab sedan, 56 km/h | 543 / 543 mm | 57.5 / 56.8 g | 66.1 / 66.1 km/h | 61.4 / 61.5% | 0.6 / 4.0 s |
| Lexus, 56 km/h | 583 / 582 mm | 69.1 / 68.0 g | 66.0 / 66.0 km/h | 63.1 / 63.1% | 1.4 / 2.6 s |
| Mustang, 48 km/h | 552 / 553 mm | 35.0 / 34.4 g | 55.7 / 55.8 km/h | 73.9 / 73.9% | 1.1 / 2.5 s |
The peak deceleration comes out 1–2% lower on the GPU. Its telemetry is taken once per recorded frame (1 ms) rather than every 0.1 ms step, so the filtered peak is a little smoother.
The labs' crashes (CPU / GPU). On the CPU some parts came off; on the GPU none can, so these aren't quite the same crash:
| Lab crash | What the lab reports | CPU | GPU |
|---|---|---|---|
| Overlap 40%, honeycomb, 40 mph | peak, crush, honeycomb crushed | 27.6 g, 503 mm, 397 mm | 27.6 g, 520 mm, 390 mm |
| Overlap 25%, rigid, 40 mph | peak, crush, hinge pillar | 25.3 g, 428 mm, 158 mm | 25.7 g, 438 mm, 144 mm |
| Two cars (Mustang vs 2,400 kg Lexus), 40 mph each | Δv A / B | 79.8 / 63.4 km/h | 79.7 / 63.5 km/h |
| Side, barrier trolley 37 mph, mild steel | B-pillar, Δv | 252 mm, 38.9 km/h | 253 mm, 38.5 km/h |
| Side, pole 20 mph | B-pillar, Δv | 42.7 mm, 49.7 km/h | 42.6 mm, 49.3 km/h |
In the games. Race and Destruction can run their crashes on the GPU too (the Crash physics button). The world barrier is covered there: up to 160 boxes and posts, as one distance field (the nearest shape's distance and normal), boxes that move at a steady speed (contacts and friction relative to the box), and roofs, which act as a floor for the nodes above them. Cars that start in the air, at a height and pitch, are set up on the CPU before the first step. gpu-check.js compares three such crashes with the CPU: a Lexus at 56 km/h into a box wall turned 30°, a tanker-sized box at 15 m/s into a stopped Lexus, and a Lexus and a Mustang head-on at 80 km/h each between a building and a lamp post.
At this lattice size the GPU is slower. The cars have about 1,000 nodes and 10,000 springs, and every 0.1 ms step is about 30 small compute dispatches, plus a read-back every recorded frame. The GPU pays off on finer lattices. Same check, the lab sedan's lattice refined, first 150 ms after contact:
| Lattice | Nodes | Springs | CPU | GPU | GPU speed-up |
|---|---|---|---|---|---|
| As used (1×) | 672 | 6,506 | 0.25 s | 0.65 s | 0.4× |
| 2× finer | 4,230 | 46,905 | 1.6 s | 0.9 s | 1.8× |
| 3× finer | 13,002 | 151,419 | 5.2 s | 1.5 s | 3.5× |
The crush agrees within 2 mm at every resolution.
Occupant and injury models
The dummies are driven by the crash, like a sled test. The vehicle simulation produces the cabin's motion, and the dummy reacts to it inside the cabin frame. The frontal dummy also feels the cabin deforming around it: the parts of the interior it can touch move with the crushed structure. Its own forces aren't fed back into the car; at 75 kg against a 1,500–2,000 kg car they would barely change it. So the dummy stays cheap enough to re-run instantly with other restraints on the same crash.
Frontal dummy (occupant.js)
Body. A 3D multibody of 15 particles, 75 kg in all:
- pelvis: both hip joints and the sacrum;
- torso: thorax, T1 (the base of the neck) and both shoulders, which carry the arms' mass;
- sternum: on a compliant chest;
- head: the top of the neck (occipital condyle) and the front and back of the skull;
- legs: knees and ankles.
Distance constraints keep each segment rigid. The joints are springs with damping and end stops: the lumbar spine at the sacrum, the hips, the knees, and the lower and upper neck. Torques act on each segment through its inertia (α = I⁻¹τ), so they turn it without pushing it.
- Three-point belt, in 3D. The shoulder belt runs from the D-ring on the B-pillar over the collarbone (between the neck and the outboard shoulder) and the sternum to the buckle beside the inboard hip. So the torso can twist out of it, as real ones do. The lap belt runs across the front of the pelvis. A pretensioner takes out up to 8 cm of slack in the first milliseconds, and a force limiter caps the webbing tension at 4.5 kN.
- Driver airbag. A flattened ellipsoid (the same shape that's drawn) growing out of the steering wheel along the column. It fires when the cabin's speed change reaches 2 m/s within 45 ms of contact, then vents. It catches the head, chest and shoulders; its damping grows as the contact patch does.
- Seat. The cushion and seat back behave like foam: firm going in, giving back about a quarter of the force on the way out. The seat back has friction, and side bolsters hold the pelvis. There is also a head restraint.
- Contacts:
- the steering wheel's rim and hub, with a collapsing column;
- the windshield (it cracks where the head hits) and the roof, placed per car from its glass and roof lines;
- the A-pillar, the door beside the pelvis, chest and shoulder, and the side window beside the head;
- the knee bolster (its padding crushes), the floor and the toe pan (with friction), and the centre console;
- chin to chest.
- The cabin deforming around it.
physics.js cabinInput()embeds interior points in the lattice: the wheel hub and a point down the column, the knee bolster, the toe pan, the windshield's edges, the roof, the A-pillar's foot and top, and the door at chest and window height. It reports where they are at every recorded frame, in the cabin frame the crash pulse is measured in. The contact surfaces move with them, so a column driven back carries the wheel and airbag (drawn moving too), and a toe pan pushed in pushes the feet. In the 25% small-overlap test the toe pan comes back about 10 cm, and the driver's left foot ends up about 10 cm further back than with a fixed cabin. Injury criteria. Channels are filtered per SAE J211 (CFC 1000 head, CFC 180 chest, CFC 600 neck and femur) and scored against FMVSS 208-style limits. The upper neck's axial force comes from Newton's law on the head; its flexion moment, for Nij, is the upper neck joint's torque at the occipital condyle. The formulas are in Equations and sources.
Criterion Limit HIC15 (head injury criterion, 15 ms window) 700 Chest acceleration, 3 ms clip 60 g Chest deflection 63 mm VC (viscous criterion: chest compression × its rate, for soft-tissue injury) 1.0 m/s Nij (neck injury criterion: axial force and flexion/extension moment) 1.0 Neck tension / compression 4.17 / 4.0 kN Femur axial force 10 kN
Side-impact dummy
- Body. A frontal-plane dummy: pelvis, thorax with struck-side ribs, shoulders, neck and head, in the struck car's frame.
- Loading. The car's lateral acceleration, taken from the undamaged far half of the car where the seats are mounted. Also the door's inner surface, taken from the lattice at pelvis, chest and window height. Door padding crushes at a plateau force.
- Window and curtain. The window glass breaks at 4 kN or when the intruding door reaches it. A vented curtain airbag fires on a 1 m/s lateral speed change.
- Criteria. HIC36 (limit 1,000), rib deflection from a chest potentiometer (44 mm), pelvis force (6 kN).
Organs: the third collision
The brain and the heart are masses on springs inside the head (50 Hz) and the chest (25 Hz). They keep moving after the body has stopped and then strike the inside of the skull or rib cage: the "third collision". It is why a hard stop can injure the brain or tear the aorta without a mark outside.
Whiplash dummy (whiplash.js)
- Spine. A side-view chain of pelvis, 24 vertebrae (5 lumbar, 12 thoracic, 7 cervical) and head. Each joint has a rotational spring and a damper, with an end stop in the neck. The damping is integrated exactly per joint, because explicit damping is unstable on 2 cm vertebrae.
- Seat. Foam, a 25° seatback on a recliner that yields above 2.2 kN·m, and a head restraint placed by backset and height.
- Sled pulse. A triangular pulse of 91 ms whose speed change is half the striking car's speed: a stationary car struck from behind.
- Criteria. Head-restraint contact time (70 ms or less), T1 acceleration (9.5 g or less), NIC (15 m²/s²), neck extension.
Pedestrian (pedestrian.js)
- Body. A 2D chain of feet, knees, pelvis, chest, neck and head, for an adult (1.75 m, 75 kg) or a 6-year-old child (1.17 m, 23 kg), struck in the car's plane.
- The car's front. Built from the car's real side profile. Its surfaces crush in two stages (elastic, then plastic): the bumper (rigid steel or energy-absorbing foam), the hood's leading edge, the hood (it dents onto the engine), the windshield and the roof edge.
- Criteria. HIC15 is scored separately for the head striking the car and the road. Also tibia and pelvis acceleration, knee bending, wrap-around distance and throw.
- Emergency braking. A rule-based model of a radar-and-camera system:
- it sees ±25° to 60 m (45 m for a child), unless a parked car blocks the line of sight (checked with a segment-box test);
- it confirms a pedestrian after 0.25 s;
- it warns at 1.8 s to collision;
- it brakes at 1.1 s (0.85 g, built up over 0.25 s after 0.1 s of latency).
How each crash lab works
| Lab | Setup in the physics |
|---|---|
| Frontal overlap | An offset barrier: a rigid block 1 m wide covering 40% or 25% of the Lexus's width, optionally faced with honeycomb (0.54 m deep). The lab gives the cabin's outer front corners (toe pan, hinge pillar) sheet-metal strength instead of safety-cell strength, so a wheel driven back can push them in. Intrusion points are measured in the undamaged-cabin frame. |
| Two vehicles | Two lattices in one solver, placed nose to nose at the chosen angle with a tiny gap, no barrier. Each car gets its own crash pulse, dummy, plastic work and momentum. Mass is set independently of the model. The camera follows the pair's centre of mass, which moves at a nearly steady speed through the crash. |
| Side impact | Two units: the struck Lexus, standing still, and the barrier trolley. The trolley is a lattice with a crushable SUV-height face (0.38–1.14 m, 0.45 m deep) on a rigid body. In the pole test, the car slides sideways on a low-friction carrier (friction 0.03) into a fixed cylinder. The door ring (doors, B-pillar, sill, roof rail) uses the chosen steel: mild 0.6× stiffness and yield, hot-stamped 1.4× stiffness and 1.8× yield. The cabin between floor and roof is hollow, so the door can come in. |
| Whiplash sled | No vehicle physics: the sled pulse drives the seat and spine model directly. |
| Occupant restraints | A 35 mph (56 km/h) full-width rigid-barrier crash of the Lexus. The same crash pulse drives three dummy runs (unbelted, plain belt, full system), and the organ model splits the crash into its three collisions. |
| Pedestrian & braking | The car's motion is planned first: constant speed, sensor detection and braking. The impact is then computed with the pedestrian chain; the pedestrian is too light to change the car's motion. The other bumper is run too, for comparison. |
Simulation diagrams
Each simulation as a pipeline from its settings to what you see, followed by the timing or state logic that drives it. The numbers are the model's actual thresholds and settings.
Colour key for the pipeline charts:
- blue: settings;
- amber: the model that is built;
- purple: computation;
- red: decisions;
- green: results on screen.
Rigid barrier
Simulator.html?preset=rigid: the free simulator's full-frontal test (preset 56 km/h, Realistic damage).
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Setup"]
direction TB
S1["Vehicle<br/>Lexus RX 350 · Mustang GT500 · Lab sedan"]
S2["Speed 10–150 km/h<br/>approach angle −45° to +45°"]
S3["Mass Light / Standard / Heavy<br/>0.73× · 1× · 1.47× curb mass"]
S4["Front stiffness<br/>Soft 0.6× · Standard · Stiff 1.7×"]
S5["Damage<br/>Realistic, or Dramatic: break limits × 0.3"]
S6["Seatbelt on/off · airbag on/off"]
end
subgraph APP["2 · Approach"]
direction TB
A1["Start 30–130 m back (3 s at speed)<br/>0.6 m off the line, 4° heading error"]
A2["PID speed control → drive or brake force"]
A3["Pure-pursuit steering on a kinematic bicycle model"]
A4{"Gap ≤ 1 cm + 4 ms of travel?"}
A1 --> A2 --> A3 --> A4
A4 -- "no: 1 ms steps" --> A2
end
subgraph BUILD["3 · Model"]
direction TB
B1["Lattice fitted to the body<br/>Lexus: 999 nodes · 9,913 springs<br/>13 neighbours per node"]
B2["Zones: crumple zone 1× · engine block 2.5×<br/>safety cell 2.5× k, 2.4× yield · rear 1.5×"]
B3["Mass: 12% on the engine · 20 kg per wheel corner<br/>ghost nodes 0.25 kg carry the render mesh"]
B4["Rigid barrier: concrete block, face at x = 0<br/>18 m wide · 3 m tall · friction 0.3"]
B5["Parts on the lattice: bumpers, hood, fenders,<br/>doors, trunk, mirrors, panes, lamps, wheels"]
end
subgraph RUN["4 · One substep, repeated"]
direction TB
R1["Predict: gravity, x ← x + v·Δt"]
R2["XPBD springs with compliance 1/k<br/>and 8% critical damping"]
R3["Plastic yield: strain beyond yield<br/>moves the rest length (0.25–1.8× L₀)"]
R4["Contacts: ground, tyres, barrier face<br/>(forces summed like a load-cell wall)"]
R5["Coulomb friction → friction heat"]
R6["Velocities v = (x − x*) / Δt"]
R7["Every 5th substep: damage checks<br/>part off at mean plastic strain of its mounts<br/>wheel off at 30% or 45 cm back · tyre burst at the rim"]
R1 --> R2 --> R3 --> R4 --> R5 --> R6 --> R7
R7 -- "Δt = 0.1 ms to T0 + 0.3 s, then 0.5 ms" --> R1
end
REC["Record: every node, its plastic strain, cabin frame,<br/>energy · every 1 ms to +0.3 s, 4 ms to +1 s, then 10 ms"]
STOP{"T0 + 2.0 s<br/>(1.2 s Lab sedan)?"}
subgraph FIN["5 · finalize()"]
direction TB
F1["Crash pulse: cabin velocity on a 0.1 ms grid<br/>CFC 60 filter → deceleration"]
F2["Metrics: impact speed · Δv · rebound · peak g<br/>time to stop · max and permanent crush · intrusion"]
F3["Glass and lamps from the recorded strain<br/>tempered 6% · roof 12% · lamps 10% · windshield cracks 2.5%"]
end
subgraph DUMMY["6 · Occupant"]
direction TB
D1["15-particle 3D dummy: crash pulse<br/>+ the cabin deforming around it"]
D2["Belt: pretensioner up to 8 cm · 4.5 kN load limiter<br/>Airbag: fires at Δv 2 m/s within 45 ms"]
D3["Contacts: wheel and column · windshield · roof<br/>knee bolster · chin to chest"]
D4["SAE J211 filters → HIC15 · chest 3 ms<br/>deflection · Nij · neck tension and compression"]
D1 --> D2 --> D3 --> D4
end
subgraph HAZ["7 · After the crash"]
direction TB
H1{"Front crushed back<br/>to the radiator?"}
H2{"Engine driven back<br/>≥ 30 cm?"}
H3["Steam vents"]
H4["Engine-bay fire<br/>smoke 0.3 s · flames 1.2 s · well alight 9 s"]
H1 -- yes --> H3
H2 -- yes --> H4
end
subgraph OUT["8 · Playback and results"]
direction TB
O1["Slow-motion replay 1/40× to 1×<br/>free camera follows the car"]
O2["Injury criteria vs FMVSS 208 limits<br/>HIC15 700 · chest 60 g, 63 mm · Nij 1.0"]
O3["Charts: occupant · vehicle (pulse, force vs crush)<br/>energy: where ½mv² went"]
O4["Damage list: parts off · panes · tyres"]
O5["Re-run the dummy with other restraints<br/>on the same crash"]
end
SET --> APP --> BUILD --> RUN
RUN --> REC --> STOP
STOP -- no --> RUN
STOP -- yes --> FIN
FIN --> DUMMY --> OUT
FIN --> HAZ --> OUT
D3 -. "head strike cracks the windshield" .-> O1
S1 ~~~ S4
S2 ~~~ S5
S3 ~~~ S6
B1 ~~~ B4
B2 ~~~ B5
O1 ~~~ O4
O2 ~~~ O5
class S1,S2,S3,S4,S5,S6 input
class B1,B2,B3,B4,B5 model
class A1,A2,A3,R1,R2,R3,R4,R5,R6,R7,REC,F1,F2,F3,D1,D2,D3,D4 calc
class A4,STOP,H1,H2 decide
class H3,H4,O1,O2,O3,O4,O5 out
The first 150 ms, as the restraints see it (times are relative to the airbag's firing time, t_fire):
sequenceDiagram autonumber participant Car as Car structure (lattice) participant Pulse as Cabin pulse participant Ctl as Restraint controller participant Belt as Seatbelt participant Bag as Airbag participant Dum as Dummy Car->>Car: First node reaches the barrier face (T0) Car->>Car: Crumple zone yields, rest lengths shorten Car->>Pulse: Cabin decelerates (CFC 60) Pulse->>Ctl: Speed change reaches 2 m/s within 45 ms of T0 (t_fire) Ctl->>Belt: Pretensioner pulls from t_fire + 1 ms to + 9 ms, up to 8 cm, while belt force is below 1.5 kN Ctl->>Bag: Starts inflating at t_fire + 4 ms, full 26 ms later Dum->>Belt: Torso loads the shoulder and lap belts Belt-->>Dum: Load limiter pays out webbing at 4.5 kN Dum->>Bag: Head and chest ride down on the bag Note over Bag,Dum: From t_fire + 110 ms the bag vents, its stiffness falling to 25% over 120 ms Car->>Car: Maximum crush, then elastic rebound Dum->>Dum: Rebounds into the seat Note over Dum: Scored over T0 − 5 ms to T0 + 300 ms
Brick wall
Simulator.html?preset=brick: the same free simulator into a breakable wall (preset 64 km/h, Dramatic damage).
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Setup"]
direction TB
S1["Vehicle · speed · angle · mass · stiffness<br/>damage · restraints (as for the rigid barrier)"]
S2["Mortar strength per joint<br/>weak 8 kN · standard 30 kN · strong 120 kN"]
end
subgraph WALL["2 · The wall"]
direction TB
W1["366 bricks, 40 × 20 × 25 cm, 2,000 kg/m³<br/>12 courses in running bond, 12 m wide"]
W2["Each brick a rigid body:<br/>position · quaternion · velocity · spin"]
W3["Mortar joints: two bond points each,<br/>front and back, so joints carry bending"]
W4["Anchors: footing under the bottom course<br/>and a pillar at each end, 1.5× strength"]
W1 --> W2
W1 --> W3 --> W4
end
subgraph CAR["2 · The car"]
direction TB
C1["Lattice, zones and parts<br/>as for the rigid barrier"]
end
subgraph RUN["3 · One substep, repeated"]
direction TB
R1["Predict nodes and awake bricks<br/>(gyroscopic term for free spin)"]
R2["Car springs: XPBD with plastic yield"]
R3["Mortar bonds touching an awake brick:<br/>stiff point constraints, compliance 2×10⁻⁸ m/N"]
R4{"Tension or shear<br/>above the bond's strength?"}
R5["Bond breaks: stored energy → fracture<br/>break event: sound, dust, chips"]
R6["Support search from the anchors<br/>through intact bonds: cut-off bricks wake and fall"]
R7["Node–brick contacts through a spatial hash<br/>brick–brick and brick–ground contacts"]
R8["Friction · velocities · contact velocity pass<br/>still bricks go to sleep"]
R1 --> R2 --> R3 --> R4
R4 -- yes --> R5 --> R6 --> R7
R4 -- no --> R7
R7 --> R8
R8 -- "next substep" --> R1
end
subgraph FIN["4 · After the run"]
direction TB
F1["Brick poses recorded every frame<br/>(position + quaternion)"]
F2["Crash pulse, metrics, glass,<br/>dummy and injury criteria as for the rigid barrier"]
F3["Steam / fire rule"]
end
subgraph OUT["5 · Playback and results"]
direction TB
O1["Bricks fly, tumble and settle in slow motion"]
O2["Energy chart includes mortar fracture and<br/>the bricks' gravitational energy"]
O3["Note: a breaking wall absorbs energy and lengthens<br/>the crash, so injury numbers aren't comparable<br/>with rigid-barrier tests"]
end
SET --> WALL & CAR
WALL --> RUN
CAR --> RUN
RUN -- "2.2 s (Lab sedan) or 2.4 s after T0" --> FIN --> OUT
class S1,S2 input
class W1,W2,W3,W4,C1 model
class R1,R2,R3,R5,R6,R7,R8,F1,F2,F3 calc
class R4 decide
class O1,O2,O3 out
A brick's life, and a mortar bond's:
stateDiagram-v2
direction LR
state "Dormant (held by its bonds)" as Dormant
state "Awake (simulated)" as Awake
state "Sleeping (loose, at rest)" as Sleeping
[*] --> Dormant
Dormant --> Awake: a car node touches it
Dormant --> Awake: a bond to it reaches 40% of its strength
Dormant --> Awake: its path to the footing or pillars is cut
Awake --> Dormant: still for 0.15 s, supported and bonded
Awake --> Sleeping: still for 0.15 s, loose or unsupported
Sleeping --> Awake: pushed hard by the car
note right of Awake
still means below 0.08 m/s
and 0.5 rad/s
end note
stateDiagram-v2
direction LR
state "Intact" as Intact
state "Broken" as Broken
[*] --> Intact
Intact --> Broken: tension, combined force above its strength
Intact --> Broken: compression, shear above strength + 0.6 × compression
Broken --> [*]: stored energy booked as fracture
note right of Intact
each joint is two bond points
sharing the joint's strength
end note
Frontal overlap lab
Simulator.html?lab=overlap: part of the front hits a barrier.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Settings"]
direction TB
S1["Speed 10–50 mph (mph)<br/>default 40 mph = 64 km/h"]
S2["Overlap (overlap)<br/>40% moderate · 25% small"]
S3["Barrier face (barrier)<br/>aluminium honeycomb · rigid"]
end
subgraph BAR["2 · Offset barrier"]
direction TB
B1["Rigid block 1 m wide, 1.5 m tall<br/>inner edge at −W/2 + overlap × W"]
B2{"Honeycomb?"}
B3["5 cm cell grid: main block 0.20–0.85 m high,<br/>0.45 m deep, crushes at 0.342 MPa"]
B4["Front strip 0.28–0.61 m high, 0.09 m deep,<br/>1.711 MPa: 0.54 m in front of the block"]
B5["No honeycomb: block edge rounded<br/>to 150 mm"]
B1 --> B2
B2 -- yes --> B3 --> B4
B2 -- no --> B5
end
subgraph CAR["2 · Lexus RX 350"]
direction TB
C1["Standard lattice and zones"]
C2["Footwell option: cabin's outer three node layers,<br/>last 0.55 m before the firewall:<br/>sheet-metal strength 1.1× k, 1× yield"]
C3["Measurement points: steering column · brake pedal<br/>toe pan · hinge pillar · dash"]
C1 --> C2
C1 --> C3
end
subgraph APP["3 · Guided approach"]
direction TB
A1["Same controllers as the barrier tests<br/>stops 0.54 m earlier with honeycomb"]
end
subgraph RUN["4 · Impact substeps"]
direction TB
R1["XPBD springs and plastic yield"]
R2["Node vs barrier: signed-distance contact<br/>(block with rounded edge)"]
R3["Node vs honeycomb: claims the cells under<br/>its share of the face"]
R4{"Pressure above<br/>the cell's crush stress?"}
R5["Cell holds: node stopped"]
R6["Cell crushes at constant force,<br/>at most the node's forward advance per step<br/>crush work booked separately"]
R7["Cell bottoms out with 6 cm left"]
R1 --> R2 --> R3 --> R4
R4 -- no --> R5
R4 -- yes --> R6 --> R7
end
subgraph ANA["5 · Analysis"]
direction TB
N1["Intrusion of each point in a frame fitted<br/>to the undamaged rear cabin (polar decomposition)"]
N2{"Over the limit?<br/>column 10 cm · pedal, toe pan, hinge 15 cm"}
N3["Dummy: belt and airbag, scored as<br/>for the barrier tests"]
N4["Yaw: how far the car turned"]
N5["Steam / fire rule"]
N1 --> N2
end
subgraph OUT["6 · Results"]
direction TB
O1["Live: time · pulse · column vertical and lateral<br/>pedal · toe pan"]
O2["Intrusion, largest and permanent, flagged"]
O3["Charts: crash pulse (longitudinal, lateral) · cabin speed<br/>barrier force · column · lower intrusion<br/>head acceleration · chest deflection · energy"]
O4["Honeycomb crushed (cm), cells drawn crushed"]
end
SET --> BAR & CAR
BAR --> APP
CAR --> APP
APP --> RUN --> ANA --> OUT
O1 ~~~ O3
O2 ~~~ O4
class S1,S2,S3 input
class B1,B3,B4,B5,C1,C2,C3 model
class A1,R1,R2,R3,R5,R6,R7,N1,N3,N4,N5 calc
class B2,R4,N2 decide
class O1,O2,O3,O4 out
Why the two overlaps differ (the claim the physics check holds it to):
flowchart LR
classDef good fill:#dcfce7,stroke:#16a34a,color:#0f172a
classDef bad fill:#fee2e2,stroke:#dc2626,color:#0f172a
subgraph M40["40% moderate overlap"]
direction TB
a1["Barrier covers 77 cm<br/>of the 192 cm front"]
a2["Engine block and crumple zone<br/>in the load path"]
a3["Front crushes progressively<br/>(honeycomb crushes like another car)"]
a4["Cabin holds: check at 40 mph,<br/>hinge pillar 6.8 cm"]
a1 --> a2 --> a3 --> a4
end
subgraph M25["25% small overlap"]
direction TB
b1["Barrier covers 48 cm,<br/>mostly outside the engine block"]
b2["Wheel and suspension<br/>driven back"]
b3["Wheel pushes into the hinge pillar<br/>and toe pan (sheet-metal strength)"]
b4["Footwell and pillar intrude, car yaws:<br/>check at 40 mph rigid, hinge pillar 15.8 cm"]
b1 --> b2 --> b3 --> b4
end
class a4 good
class b4 bad
Two-vehicle collision lab
Simulator.html?lab=multi: two cars crash into each other in one solver.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Settings"]
direction TB
SA["Car A: class (aCls), mass 800–3,000 kg (aMass),<br/>speed 0–60 mph (aMph)<br/>default: Mustang 1,890 kg at 40 mph"]
SB["Car B: class (bCls), mass (bMass), speed (bMph)<br/>default: Lexus, heavy, 2,400 kg at 40 mph"]
SG["Approach angle 0–45° (angle)"]
SC["Classes: coupe = Mustang · suv / heavy = Lexus<br/>compact = Lab sedan (simple model)"]
end
subgraph GEO["2 · Placement"]
direction TB
G1["Car A at x below 0, heading 0<br/>Car B nose to nose, heading 180° − angle"]
G2["Gap 2 cm + (vA + vB) × 4 ms"]
G3["Approach: both drive at constant speed<br/>for 2.4 s into position"]
end
subgraph BUILD["3 · One solver, two units"]
direction TB
U1["Both lattices concatenated into one node<br/>and constraint array, each with its own zones"]
U2["Car-to-car contacts: nodes as 12 cm spheres,<br/>spatial hash over the bounding-box overlap"]
U3["Approach-only: a contact never separates<br/>faster than 2 cm/s (crushed fronts interlock)"]
U4["Sheet metal on sheet metal: friction 0.4"]
U1 --> U2 --> U3 --> U4
end
subgraph RUN["4 · Impact, 1.4 s"]
direction TB
R1["Same substep: XPBD, plastic yield,<br/>ground and car-to-car contacts, friction"]
R2["Per car: cabin frame, crush, contact force,<br/>plastic work, momentum and kinetic energy"]
R3["Per car: crash pulse and metrics"]
R1 --> R2 --> R3
end
subgraph ANA["5 · Analysis"]
direction TB
N1["A dummy in each car: belt and airbag"]
N2["Δv of each driver (vector)"]
N3["Momentum: before, and 150 ms after<br/>(tyres and road take a little)"]
N4["Energy: motion of each car · bent metal of each<br/>springback and parts · heat"]
N5["Steam / fire rule for each car"]
end
subgraph OUT["6 · Results"]
direction TB
O1["Δv bars: each driver's speed change,<br/>peak g, crush, HIC, chest"]
O2["Momentum arrows in the scene:<br/>car A, car B, and the total"]
O3["Charts: Δv of each car · cabin deceleration<br/>force between the cars · energy · drivers"]
O4["Free camera follows the pair's centre of mass"]
end
SET --> GEO --> BUILD --> RUN --> ANA --> OUT
SA ~~~ SG
SB ~~~ SC
N1 ~~~ N4
N2 ~~~ N5
O1 ~~~ O3
O2 ~~~ O4
class SA,SB,SG,SC input
class G1,G2,U1,U2,U3,U4 model
class G3,R1,R2,R3,N1,N2,N3,N4,N5 calc
class O1,O2,O3,O4 out
What the lab teaches, step by step:
sequenceDiagram participant A as Car A (mass mA) participant I as Contact between the fronts participant B as Car B (mass mB) A->>I: Fronts meet, both crumple zones crush I->>A: Force F pushes A back I->>B: Force F pushes B back (Newton's third law) Note over A,B: The same force for the same time gives each car the same impulse J A->>A: Speed change ΔvA = J / mA B->>B: Speed change ΔvB = J / mB Note over A,B: The lighter car's speed changes more, so its driver's crash is harder Note over A,B: Total momentum is kept, while the kinetic energy becomes bent metal and heat
Side impact lab
Simulator.html?lab=side: a barrier trolley or a pole hits the driver's door.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Settings"]
direction TB
S1["Striking object (impactor)<br/>barrier trolley at 37 mph · pole at 20 mph"]
S2["B-pillar and door ring steel (steel)<br/>mild · hot-stamped"]
S3["Curtain airbag (curtain)"]
end
S1 --> K{"Impactor?"}
subgraph MDB["2a · Barrier trolley"]
direction TB
M1["1,900 kg lattice, 480 nodes, 3.6 m long"]
M2["Crushable face: 0.38–1.14 m high (SUV height),<br/>0.45 m deep, 1.68 m wide · 0.8× k, 0.9× yield"]
M3["Rigid trolley behind it: 6× k, 30× yield"]
M4["Heads across the car at 37 mph,<br/>aimed just behind the driver's H-point"]
end
subgraph POLE["2b · Pole"]
direction TB
P1["Fixed 254 mm cylinder<br/>in line with the driver"]
P2["The car slides sideways into it at 20 mph<br/>on a low-friction carrier (friction 0.03)"]
end
subgraph CAR["2 · Struck Lexus"]
direction TB
C1["Door ring (doors, B-pillar, sill, roof rail),<br/>outer two node layers along the cabin:<br/>mild 0.6× k, 0.6× yield · hot-stamped 1.4× k, 1.8× yield"]
C2["Cabin between floor and roof hollow<br/>(cross springs 0.12×), so the door can come in"]
C3["Measurement points: B-pillar at three heights<br/>door at pelvis, chest and window height"]
end
subgraph RUN["3 · Impact, 0.5 s"]
direction TB
R1["Trolley: car-to-car contacts in one solver<br/>Pole: signed-distance contact"]
R2["Telemetry: velocity of the car's far half<br/>(where the seats are mounted)"]
R3["Intrusion in a frame fitted to the far side"]
R1 --> R2 --> R3
end
subgraph INPUT["4 · Dummy input"]
direction TB
I1["Lateral acceleration of the far half"]
I2["Door's inner surface: pelvis and chest<br/>(trim 20 cm in) · window (16 cm in)"]
I3["Striker surface: the trolley face's top edge<br/>or the pole, in the car's frame"]
end
subgraph DUM["5 · Side dummy"]
direction TB
D1["Pelvis 14 kg · thorax 20 kg · T1 8 kg<br/>neck 1.2 kg · head 4.6 kg · struck-side ribs"]
D2["Padding: elastic, then a plateau force,<br/>then bottoming out"]
D3["Window glass breaks at 4 kN<br/>or when the striker reaches it"]
D4["Curtain: fires at a 1 m/s lateral speed change<br/>within 30 ms · vented, up to 1.2 kN"]
D5["Scores: HIC36 · rib deflection · pelvis force"]
D1 --> D2 --> D3 --> D4 --> D5
end
subgraph OUT["6 · Results"]
direction TB
O1{"B-pillar intrusion over 15 cm?"}
O2["Dummy vs limits: HIC36 1,000<br/>rib deflection 44 mm · pelvis 6 kN"]
O3["Charts: intrusion with the curtain's inflation window<br/>rib deflection · pelvis force · head · car lateral g"]
O4["Re-run the dummy with or without<br/>the curtain on the same crash"]
O5["3D: crushed door, curtain unrolling inside<br/>the window, honeycomb face crushing"]
end
K -- trolley --> MDB
K -- pole --> POLE
S2 --> CAR
MDB --> RUN
POLE --> RUN
CAR --> RUN
RUN --> INPUT --> DUM --> OUT
S3 --> DUM
M1 ~~~ M3
M2 ~~~ M4
O1 ~~~ O4
O2 ~~~ O5
class S1,S2,S3 input
class M1,M2,M3,M4,P1,P2,C1,C2,C3 model
class R1,R2,R3,I1,I2,I3,D1,D2,D3,D4,D5 calc
class K,O1 decide
class O2,O3,O4,O5 out
The race between the door and the curtain airbag:
sequenceDiagram
autonumber
participant Str as Trolley or pole
participant Door as Door ring (lattice)
participant Car as Struck car (far half)
participant Ctl as Curtain controller
participant Cur as Curtain airbag
participant Glass as Window glass
participant Dum as Side dummy
Str->>Door: Contact: face crushes, door ring yields
Door->>Dum: Door trim reaches the pelvis, ribs and shoulder
Door->>Car: Load passes through the floor to the far side
Car->>Ctl: Lateral speed change reaches 1 m/s within 30 ms (t_fire)
Ctl->>Cur: Inflates from t_fire + 6 ms, full 18 ms later, 12 cm thick
Dum->>Glass: Head swings toward the window
alt Glass load above 4 kN, or the striker reaches the window
Glass-->>Dum: Glass breaks, the striker becomes the hard surface
end
Cur-->>Dum: Cushions the head, force levelling off at 1.2 kN as it vents
Note over Door,Dum: Scored: B-pillar intrusion, HIC36, rib deflection, pelvis force
Whiplash sled lab
Simulator.html?lab=whiplash: a seat on a sled is shoved forward, as when a stopped car is hit from behind.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Settings"]
direction TB
S1["Striking-car speed 20–30 mph (mph)"]
S2["Head-restraint backset 0–12 cm (backset)"]
S3["Head-restraint height −12 to +4 cm<br/>vs the top of the head (height)"]
end
subgraph PULSE["2 · Sled pulse"]
direction TB
P1["Speed change = half the striking speed<br/>(a stationary car struck from behind)"]
P2["Triangular, 91 ms long, starting at 10 ms<br/>peak = 2 × Δv / 91 ms (20 mph: about 10 g)"]
P1 --> P2
end
subgraph SEAT["3 · Seat"]
direction TB
T1["Seatback 25° from vertical,<br/>surface 13.5 cm behind the H-point"]
T2["Foam 2,100 N/m per contact point, 12 cm deep"]
T3["Recliner 12,000 N·m/rad, yields above 2.2 kN·m"]
T4["Head restraint 24 cm tall,<br/>placed by the backset and height settings"]
end
subgraph DUM["4 · Dummy, 26 bodies"]
direction TB
D1["Pelvis 15 kg"]
D2["Lumbar L5–L1: 5 × 1.6 kg<br/>350 N·m/rad per joint"]
D3["Thoracic T12–T1: 12 × 2.6 kg<br/>600 N·m/rad per joint"]
D4["Cervical C7–C1: 7 × 0.3 kg<br/>11 N·m/rad, stops at ±0.25 rad"]
D5["Head 4.5 kg, radius 9.5 cm"]
D1 --> D2 --> D3 --> D4 --> D5
end
subgraph RUN["5 · 0.1 ms steps, 0.3 s"]
direction TB
R1["Sled acceleration applied to the seat frame"]
R2["Joint springs; damping integrated exactly<br/>per joint (stable on 2 cm vertebrae)"]
R3["Seatback foam and recliner moment"]
R4{"Head touching the restraint?"}
R5["Restraint force on the head<br/>contact time recorded"]
R1 --> R2 --> R3 --> R4
R4 -- yes --> R5
end
subgraph SCORE["6 · Scores"]
direction TB
C1{"Contact time ≤ 70 ms?"}
C2{"T1 peak ≤ 9.5 g?"}
C3["NIC = 0.2 × a_rel + v_rel², until contact<br/>or 150 ms (limit 15 m²/s²)"]
C4["Neck extension · restraint force"]
end
subgraph OUT["7 · Results"]
direction TB
O1["Both seat-design criteria met, or which failed"]
O2["Charts: sled, T1 and head acceleration<br/>restraint force · neck extension · NIC"]
O3["3D: spine bends vertebra by vertebra,<br/>restraint turns orange on contact"]
end
SET --> PULSE --> RUN
SET --> SEAT
SEAT --> RUN
DUM --> RUN
RUN --> SCORE --> OUT
T1 ~~~ T3
T2 ~~~ T4
C1 ~~~ C3
C2 ~~~ C4
class S1,S2,S3 input
class P1,P2,T1,T2,T3,T4,D1,D2,D3,D4,D5 model
class R1,R2,R3,R5,C3,C4 calc
class R4,C1,C2 decide
class O1,O2,O3 out
The rear-impact sequence:
sequenceDiagram autonumber participant Sled participant Seat as Seat and seatback participant Torso as Pelvis, lumbar and thoracic spine participant Neck as Cervical spine participant Head participant HR as Head restraint Sled->>Seat: Pulse starts at 10 ms and lasts 91 ms Seat->>Torso: Foam pushes the torso forward Torso->>Torso: T1 accelerates (scored, 9.5 g or less passes) Torso->>Neck: The neck is dragged forward under the head Neck->>Head: The head lags and tips back (extension) Note over Neck,Head: NIC builds from the motion of T1 relative to the head Head->>HR: Head reaches the restraint (70 ms or less passes) HR-->>Head: The restraint stops the backward swing Seat->>Seat: Recliner yields if the moment passes 2.2 kN·m Head->>Torso: Rebound forward
Occupant restraint lab
Simulator.html?lab=restraint: one crash, three restraint systems, three collisions.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Setting"]
direction TB
S1["Restraint system (restraint)<br/>unbelted · plain 3-point belt · belt + limiter + airbags"]
end
subgraph CRASH["2 · One crash"]
direction TB
C1["Lexus RX 350, 35 mph (56 km/h)<br/>full-width rigid barrier, guided approach"]
C2["Vehicle physics run once → crash pulse"]
C1 --> C2
end
subgraph RUNS["3 · Three dummy runs"]
direction TB
D1["Unbelted<br/>no belt, no airbag"]
D2["Plain belt<br/>no pretensioner, no load limiter, no airbag"]
D3["Full system<br/>pretensioner, 4.5 kN limiter, airbag"]
end
subgraph ORG["4 · Organs"]
direction TB
G1["Brain: mass on a spring in the skull<br/>50 Hz, 30% damping, driven by head acceleration"]
G2["Heart: mass on a spring in the chest<br/>25 Hz, 25% damping, driven by chest acceleration"]
end
subgraph PH["5 · Three collisions"]
direction TB
P1["1 · Vehicle: first contact until the cabin stops"]
P2["2 · Occupant: belt, airbag and interior force<br/>above max(1 kN, 20% of its peak)"]
P3["3 · Organs: from the peak restraint load until<br/>the organs settle below 20% of their peak movement"]
P1 --> P2 --> P3
end
subgraph OUT["6 · Results"]
direction TB
O1["The three collisions as bars, 0–200 ms"]
O2["Selected system: HIC15 · chest compression<br/>(target under 50 mm) · chest 3 ms"]
O3["All three compared: HIC15 · chest · peak load<br/>head forward movement"]
O4["Charts: head path from the side · head acceleration<br/>chest compression · belt and airbag forces<br/>brain and heart movement"]
O5["3D: head-path trail · onboard inset<br/>switch systems on the same crash"]
end
S1 --> CRASH --> RUNS
RUNS --> ORG --> PH --> OUT
RUNS --> OUT
O1 ~~~ O4
O2 ~~~ O5
class S1 input
class C1,G1,G2 model
class C2,D1,D2,D3,P1,P2,P3 calc
class O1,O2,O3,O4,O5 out
What each system does with the same crash (the physics check's numbers at 56 km/h):
flowchart LR classDef bad fill:#fee2e2,stroke:#dc2626,color:#0f172a classDef mid fill:#fef3c7,stroke:#d97706,color:#0f172a classDef good fill:#dcfce7,stroke:#16a34a,color:#0f172a P["Crash pulse:<br/>the cabin stops in about 63 ms"] P --> U["Unbelted: the body keeps going at 35 mph<br/>until the wheel, windshield and dash stop it<br/>HIC15 about 4,250"] P --> B["Plain belt: stops the torso, but with slack<br/>and no force limit, loading the chest hard<br/>HIC15 about 1,500"] P --> F["Full system: pretensioner removes slack,<br/>limiter caps the belt at 4.5 kN, airbag catches head and chest<br/>HIC15 about 560"] class U bad class B mid class F good
Pedestrian and emergency braking lab
Simulator.html?lab=pedestrian: a pedestrian crosses, and the car may or may not brake in time.
flowchart TB
classDef input fill:#dbeafe,stroke:#2563eb,color:#0f172a
classDef model fill:#fef3c7,stroke:#d97706,color:#0f172a
classDef calc fill:#ede9fe,stroke:#7c3aed,color:#0f172a
classDef decide fill:#fee2e2,stroke:#dc2626,color:#0f172a
classDef out fill:#dcfce7,stroke:#16a34a,color:#0f172a
subgraph SET["1 · Settings"]
direction TB
S1["Speed 12–37 mph (mph)"]
S2["Pedestrian (target)<br/>adult 1.75 m, 75 kg · child 6 years, 1.17 m, 23 kg"]
S3["Bumper (bumper)<br/>rigid steel · energy-absorbing foam"]
S4["Automatic emergency braking (aeb)"]
end
subgraph PLAN["2 · Plan, 2 ms steps"]
direction TB
L1["Pedestrian walks at 1.39 m/s from the kerb<br/>(3.5 m out, 3.0 m for the child)"]
L2["Timed so the unbraked car's front meets them"]
L3["Child: steps out from in front of a parked car"]
L4["Sensor each step: in the cone, in range,<br/>line of sight clear (segment vs parked car)"]
L5["AEB state machine (below)"]
L6{"Contact before the car stops?"}
L1 --> L2 --> L4
L3 --> L4
L4 --> L5 --> L6
end
subgraph IMP["3 · Impact, 0.05 ms steps"]
direction TB
I1["6-mass chain: feet · knees · pelvis · chest<br/>neck · head, seen from the car's side"]
I2["Joint springs: knee ligaments give way past 15°<br/>hip stop · damped joints"]
I3["The car's front from its own side profile:<br/>bumper · hood edge · hood · windshield · roof edge"]
I4["Surfaces crush in two stages: the chosen bumper,<br/>steel 12 kN then 25 kN, or foam 4 kN then 15 kN"]
I5["The car's motion is imposed (the pedestrian<br/>is too light to change it)"]
I6["The road: the body lands on it after the throw"]
I1 --> I2
I3 --> I4
end
subgraph SC["4 · Scores"]
direction TB
C1["HIC15 on the car (limit 1,000), and the surface hit"]
C2["HIC15 falling onto the road, scored separately"]
C3["Knee bending (15°) · tibia (170 g) · pelvis (80 g)"]
C4["Head wrap-around distance · throw distance"]
C5["The same impact with the other bumper,<br/>for comparison"]
end
subgraph OUT["5 · Results"]
direction TB
O1["Avoided: distance to spare<br/>or impact speed, and energy taken off"]
O2["First seen · warning · full braking<br/>(seconds before impact)"]
O3["Charts: car speed with the braking window<br/>tibia, head and pelvis pulses for both bumpers"]
O4["3D: sensor cone changes colour by state,<br/>box around a tracked pedestrian"]
O5["Playback: real time until 0.12 s before impact,<br/>0.06× through the impact, then 0.3×"]
end
SET --> PLAN
L6 -- yes --> IMP --> SC --> OUT
L6 -- "no: stopped short" --> OUT
S1 ~~~ S3
S2 ~~~ S4
I2 ~~~ I5
I4 ~~~ I6
C1 ~~~ C4
C2 ~~~ C5
O1 ~~~ O4
O2 ~~~ O5
class S1,S2,S3,S4 input
class L1,L2,L3,I1,I2,I3,I4,I5,I6 model
class L4,L5,C1,C2,C3,C4,C5 calc
class L6 decide
class O1,O2,O3,O4,O5 out
The emergency-braking system's states (the colour of the sensor cone in the scene):
stateDiagram-v2
state "Scanning" as Scan
state "Pedestrian in view" as View
state "Tracking (confirmed)" as Track
state "Warning chime" as Warn
state "Braking" as Brake
state "Stopped short" as Stop
state "Impact" as Hit
[*] --> Scan
Scan --> View: in the cone of ±25°, within 60 m (45 m for a child), line of sight clear
View --> Scan: lost before it is confirmed
View --> Track: seen for 0.25 s
Track --> Warn: paths conflict, time to collision below 1.8 s
Warn --> Brake: time to collision below 1.1 s
Brake --> Stop: car stops before reaching them
Brake --> Hit: contact at a lower speed
Track --> Hit: AEB off, no warning or braking
Stop --> [*]
Hit --> [*]
note right of Brake
0.1 s latency, then braking builds
to 0.85 g over 0.25 s
end note
note left of Hit
without AEB the driver brakes
0.6 s after the impact, at 0.8 g
end note
The impact itself:
sequenceDiagram autonumber participant Car as Car front (imposed motion) participant Leg as Feet and knees participant Pel as Pelvis participant Up as Chest and neck participant Head participant Road Car->>Leg: Bumper strikes the leg (steel 12 kN plateau, foam 4 kN) Note over Leg: Knee bends, ligaments give way past 15°, tibia acceleration scored Car->>Pel: Hood edge loads the upper leg and pelvis Pel->>Up: Upper body rotates onto the hood Up->>Head: Head swings down toward the hood or windshield Head->>Car: Head strikes the car, HIC15 on the car and the wrap-around distance Car-->>Up: The car brakes or keeps going, and the body is thrown ahead Up->>Road: Body lands on the road Head->>Road: Head strikes the road, scored as a separate HIC15
Rendering the damage
Skinning the model to the lattice (GPU)
Each vertex of the imported car's mesh is embedded in the lattice cell that contains it: 8 node indices and its position (tₓ, tᵧ, t_z) in the cell. Every frame, the node positions and plastic strains are uploaded as a float texture (one RGBA texel per node). The vertex shader then rebuilds each vertex by trilinear interpolation.
Normals aren't recomputed. Each authored normal is turned by the cell's deformation gradient F through its cofactor, n′ = cof(F)·n. So the model keeps its own smoothing and hard edges while it crumples, and stays exact under rigid motion. A custom depth material skins the shadows the same way. The simple Lab sedan is a subdivided box skinned on the CPU.
Crumpled metal
The lattice, about 24 cm between nodes, is too coarse for sheet-metal folds, so the shader adds them where the lattice says the metal yielded:
- Where. From about 4.5% plastic strain, fully at 18%.
- Buckles. Broad buckles move the surface by up to 2.2 cm, along a smoothed normal so hard edges stay closed. Their wavelength is about 20 cm, as the mesh's vertices are 3–8 cm apart.
- Folds. Finer folds shade the surface through a screen-space bump, faded with distance so they don't shimmer.
- Direction. Where a lattice cell was compressed, the fold pattern blends toward copies squeezed 2.2× along that axis, so the folds run across the crush as on a crushed panel.
- Paint. Creases darken, and paint cracks off to grey primer along the sharpest ones.
- Debris. A part that comes off keeps its folds: they are baked into its frozen copy on the CPU, with a JavaScript port of the same noise.
This is visual only: intrusion and every number come from the lattice.
Other effects
- Debris is a frozen copy of the part, skinned on the CPU at the moment it came off, following its rigid body's recorded pose.
- Glass shards are instanced meshes on precomputed ballistic paths (fall, bounce, settle). They are seeded from the pane name, so scrubbing and replays are consistent.
- Windshield cracks are a spider-web pattern drawn on a canvas texture from the break origin and head strikes.
- Burst tyres flatten against the ground in the vertex shader.
- The curtain airbag is shaped from the car's driver-side window panes: a quilted cushion with sewn chambers that unrolls from the roof rail just inside the glass. Its points ride on the lattice, so the crushed door pushes it in.
- Fire and steam are camera-facing instanced sprites: flames (additive), sooty smoke, embers and steam, plus a flickering point light. Each particle's state is a pure function of its index and the time since the crash, so the fire looks the same on every replay.
- Bloom. Flames, embers and hot sparks glow. Their glow twins (a separate render layer) are drawn into a half-size buffer over the solid scene drawn in black, so the car and barrier hide what's behind them. The imported cars' black copy is skinned like the body, so the crushed engine bay doesn't hide its own fire behind the undeformed shape. The buffer is blurred down a chain of smaller buffers and back up, then added onto the frame. Everything else keeps its look, and the pass runs only while something glows. Sparks cool as they fly, so their glow fades faster than their colour.
Sound is synthesised live with Web Audio:
- structural crunch, metal clank and tearing, glass, windshield crackle, a tyre blowout (bang, casing thump, rubber flap, escaping air), airbag, the AEB chime, fire roar and crackle, steam hiss;
- each sound plays from where it happens, through an HRTF panner, and the listener follows the camera;
- a continuous structural groan follows the power the crash is absorbing (plastic work, fracture and contact losses per millisecond, from the energy books): about 0.5 at 1 MW, 0.85 at 5 MW and 1.2 at 25 MW. It grows louder, more resonant and more distorted with power, over a deeper rumble;
- in slow motion the sounds are pitched down (down to 0.4× at 1/40×) and drawn out;
- a limiter in front of the speakers keeps the loudest moments from clipping.
Point particles show sparks, dust and glass.
- Bullet-time and shake (
cinematic.js) are worked out once per replay from the crash pulse, in 1 ms bins:- Speed. The deceleration relative to its peak is widened and smoothed, so the slow-down starts a little before the peak and eases in and out. It is mapped between 1/4× and 1/40×. Once 97% of the pulse's impulse has gone by, the speed rises to real time over 250 ms.
- Shake grows with the deceleration (1 at 50 g), with kicks for first contact, parts tearing off, tyre bursts and head strikes. It goes mostly along the deceleration's direction and scales with the camera's distance. It wobbles with replay time, so it slows down in slow motion.
- Saving a video (
export.js) renders the replay frame by frame at 1920×1080 and 30 frames per second, whatever the computer's speed. Its sounds are rendered offline on the same clock (anOfflineAudioContext).- Encoding: H.264 through WebCodecs (VP9 if there is no H.264 encoder), with AAC or Opus sound.
- Container: an MP4 written by mp4-muxer.
- Overlay: the title, the replay clock and the speed are drawn on each frame.
Equations and sources
The models written out as the code computes them. Numbers in square brackets point to the references. Where a value is the model's own setting rather than a published one, it says so.
Energy, momentum and the crash pulse
The setup readouts are the kinetic energy, the height the car would have to fall from to reach the same speed, and the momentum:
Energy grows with the square of speed, so 112 km/h carries four times the energy of 56 km/h [20, 23]. The impulse-momentum theorem links the force to the time it acts for. For the same speed change, a longer crush means a lower average deceleration:
Stopping from 56 km/h over the Lexus's 0.58 m of crush averages 21 g. The measured peak (CFC 60) is 69 g, because a real pulse isn't square [20, 21].
The energy books (section 6 of the physics) account for the initial kinetic energy at every recorded frame:
When two cars crush together and leave at a common speed, momentum fixes each one's speed change. The lighter car's Δv is larger in proportion to the other car's mass, which is what the two-vehicle lab checks [20, 22]:
The labs split a crash into three collisions, as crash-science teaching does: the car against the barrier, the occupant against the restraints and interior, and the organs inside the body [24, 25].
The lattice and the XPBD step
Each substep first predicts every node's motion, keeping its old position x*:
Each spring between nodes a and b is a distance constraint with unit direction n from a to b:
Its compliance is α = 1/k. Its damping is c = 2ζ√(k m_ab), with the pair's reduced mass m_ab = m_a m_b/(m_a + m_b) and ζ = 0.08 (a model setting); γ = cα/Δt. The projection is XPBD's with one iteration per substep [2, 3]:
- w = 1/m are the inverse masses.
- With one iteration per substep the multiplier starts at zero, so the −α̃λ term of the full XPBD update drops out: this is the "small steps" scheme [3].
- XPBD comes from implicit (backward Euler) integration of the spring energy, so k is a real stiffness whatever the step size. Plain position-based dynamics [1] has a stiffness that depends on the step and the iteration count [4].
- The stiffness is k = K₀ · s_h · f_zone · s_front, with K₀ = 1.1 MN/m, s_h the lattice-spacing scale, f_zone from the zone table and s_front the Soft/Standard/Stiff setting (all model settings).
Velocities come from the positions after all corrections:
Why 0.1 ms works. Explicit finite-element crash codes are limited by the Courant–Friedrichs–Lewy condition [11]:
A 5 mm shell element gives about 1 µs, so a 100 ms crash needs about 10⁵ steps. The lattice's position-level solve is stable at much larger steps. Here the 0.1 ms step is set by the injury filters (below), not by stability.
Plastic flow. After the correction, the spring's elastic extension is e = |x_b − x_a| − L₀, and its yield extension is e_y = ε_y L_orig. If |e| > e_y, the rest length moves by the excess and the steel stays bent [8]:
The plastic work is the yield force times the flow, and the plastic strain accumulates per spring:
Contacts, friction and rigid bodies
A node that penetrates the ground or the barrier by d is moved back onto the surface. The barrier's load cell sums the forces those corrections imply:
Contacts with bricks, debris, the lab obstacles and the other car cancel the approach in that substep but never push apart faster than v_sep. That is 1 m/s, or 2 cm/s between two cars, whose crushed fronts interlock (model settings):
Friction is Coulomb friction at the position level [5, 6]. The tangential displacement Δx_t of the substep is removed while it fits inside the friction cone, μ times the normal correction d, and is reduced by that much otherwise:
- Wheel nodes split this along the car's heading (rolling resistance μ = 0.015, or 0.3 once the tyre bursts) and across it (μ = 0.8).
- Other surfaces (model settings): body on the ground 0.5, barrier 0.3, brick 0.5, car on car 0.4.
Rigid bodies (bricks, parts that came off, wheels) take contact and bond corrections at a point r from their centre of mass. They use the generalised inverse mass of XPBD rigid bodies [6]:
The spin is integrated with the gyroscopic term, so a free spin keeps its energy [7]. Debris orientation uses the exact quaternion exponential; bricks use the first-order update, then renormalise [6]:
Spatial hashing. Bricks and the other car's nodes are found through a hash of the grid cell (i, j, k), with T a power of two [9]:
The honeycomb barrier face
The offset barrier's aluminium honeycomb uses the deformable barrier's specified crush strengths: σ_c = 0.342 MPa for the main block and 1.711 MPa for the bumper strip [37]. Honeycomb crushes at a nearly constant stress [16]. A node pressing on the cells under it can be stopped by at most their crush force, and anything beyond that crushes them:
Mortar bonds
Each bond is a stiff XPBD point constraint between the two bricks' bond points p_a and p_b, with compliance α_b = 2 × 10⁻⁸ m/N (a model setting) [6]. The force it carries follows from the correction:
The force is split into the part across the joint, f_n (tension positive), and the shear f_s. The bond fails under a Coulomb criterion, the kind used for masonry joints: compression raises the shear it can carry [17]. The friction coefficient 0.6 is a model setting:
S is 8, 30 or 120 kN for weak, standard and strong mortar (model settings). The energy stored in the broken bond, ½|p_a − p_b|²/α_b, is booked as fracture.
Parts, wheels and glass
A part comes off when the mean plastic strain of the springs it is mounted on reaches its limit, ε̄_p ≥ ε_f (the table in section 5 of the physics). That is the simplest ductile-fracture rule: a constant strain to failure, as in the Johnson–Cook model with only its first constant [18]. Criteria such as Cockcroft–Latham's integrate the tensile plastic work instead [19]; they need panel stresses the lattice doesn't resolve.
When a part comes off it takes mass m_i from each node it sat on, and starts as a rigid body from their momentum:
If the body would have more kinetic energy than the nodes gave up, ω is scaled down. The difference is booked as fracture, so a break never adds energy.
- Tyre burst. The wheel nodes' floor sinks from the tyre radius R to the rim plus a quarter of the sidewall over 50 ms. Rolling resistance rises to 0.3. Tyre-blowout models in the literature also lower the rolling radius and raise the rolling resistance [55, 56].
- Wheel off. A rigid wheel starts spinning at ω = v/R, with equal inertia about every axis, so it doesn't drift gyroscopically.
- Glass breaks by rule from the recorded strain around each pane (section 5 of the physics). The shards are visual only.
Measuring: filters, pulse and intrusion
SAE J211 channel filters [26, 27]. A 2-pole Butterworth filter, with its corner pre-warped for the bilinear transform:
- Zero phase. The filter runs forward, then backward over its own output. The result has no phase lag and a 4-pole response, so peaks stay at the right time.
- Ends. Each end is padded with up to 200 samples of an odd reflection, x₋ₖ = 2x₀ − xₖ, so a signal that doesn't start at zero doesn't ring.
- Step size. Pre-warping needs ω_d Δt/2 < π/2, so Δt < 1/(4.155 · CFC): 0.24 ms for CFC 1000 and 0.40 ms for CFC 600. This is why the impact is computed at 0.1 ms.
- Classes:
- CFC 1000: head and pelvis acceleration;
- CFC 600: neck loads and femur force;
- CFC 180: chest acceleration and chest deflection;
- CFC 60: the vehicle crash pulse.
The crash pulse is the derivative of the cabin's velocity, filtered at CFC 60. Δv, the peak and the time to stop are read from it [20].
Intrusion is measured in a frame fitted to the undamaged rear corner of the cabin, so the car's own rotation doesn't count. pᵢ and qᵢ are that corner's node positions now and at rest, relative to their centroids. The fitted rotation is the rotational part of their covariance's polar decomposition, as in shape matching [14, 15]:
Skinned normals. The render mesh is embedded in the lattice cells. Each vertex is a trilinear blend of its cell's eight nodes. Each normal turns with the cell's deformation gradient through its cofactor, which keeps it perpendicular to the deformed surface [12, 13]:
Injury criteria
Limits and filter classes follow the US occupant-protection standard, FMVSS 208, for the frontal dummy [28]. The criteria come from the biomechanics behind them [30, 31, 32].
Head injury criterion [30, 33, 34]. a is the resultant head acceleration in g, at CFC 1000. The windows are at most 15 ms (36 ms for the side dummy), and every pair of samples is tried, using a trapezoidal running integral:
Chest acceleration, 3 ms clip [28]. The standard limits the level exceeded for a cumulative 3 ms, adding up every interval above it. With the chest resultant (CFC 180) sorted so that a₍₁₎ ≥ a₍₂₎ ≥ …:
Neck injury criterion [28, 30]. Each sample's quadrant (tension or compression, flexion or extension) picks the intercepts:
A physical dummy's upper-neck load cell sits below the occipital condyle, so tests correct its moment by M_OC = M_y − d F_x (d = 17.78 mm in the Hybrid III [35]). Here M_y is the neck joint's torque at the condyle itself, so no correction is needed.
Viscous criterion [36, 37]. Soft-tissue injury depends on how fast the chest is compressed as well as how far. D is the chest deflection (CFC 180), and its rate comes from the 4th-order central difference of J211. The model takes the Hybrid III constants (a 0.229 m chest, scale factor 1.3); the limit is 1.0 m/s:
Other frontal limits [28, 32]:
- chest deflection 63 mm;
- neck tension 4.17 kN and compression 4.0 kN;
- femur force 10 kN.
Side-impact dummy [29]: HIC over a 36 ms window 1,000, rib deflection 44 mm, pelvis (pubic symphysis) force 6 kN.
Organs. The brain and heart are damped masses on springs driven by their cavity's acceleration. f = 50 Hz and ζ = 0.3 for the brain, 25 Hz and 0.25 for the heart (model settings):
Whiplash. The spine has 24 vertebrae, as in the BioRID II rear-impact dummy [39]. The neck injury criterion uses T1's motion relative to the head, along the car, until head-restraint contact or 150 ms; its limit is 15 m²/s² [38]:
The seat criteria, T1 acceleration of at most 9.5 g and head-restraint contact within 70 ms, follow the RCAR-IIWPG seat evaluation protocol [48]. Each joint's damping is integrated exactly over the step, because explicit damping is unstable on 2 cm vertebrae. k is the joint's effective inverse inertia, Σ|∇ω|²/m:
Pedestrian. The limits are from the pedestrian-safety regulations:
- head HIC15 1,000, which GTR 9 allows over part of the hood (1,700 over the rest) [40];
- knee bending 15°, the EEVC WG17 legform limit [41];
- tibia acceleration 170 g, the GTR 9 legform limit [40].
Euro NCAP grades the head on a sliding scale instead, from HIC15 650 (full marks) to 1,700 (none) [42]. The emergency braking is a rule-based model. It warns at a time to collision of 1.8 s and brakes at 1.1 s, ramping to 0.85 g over 0.25 s after 0.1 s of latency (model settings, in the spirit of the AEB test protocols [49, 50]):
The test set-ups
The simulations are set up after published tests. They take each test's geometry, speed and limits, not its full procedure (dummy positioning, instrumentation, the rating's weighting of results).
| Simulation | Set up after | What the model takes from it |
|---|---|---|
| Rigid barrier; restraint lab | The US New Car Assessment Program's frontal test [43] | Full-width rigid barrier at 56 km/h (35 mph) |
| Frontal overlap, 40% | The moderate-overlap test [44] | 40% of the width at 40 mph into a deformable honeycomb face [37] |
| Frontal overlap, 25% | The small-overlap test [45] | 25% of the width at 40 mph into a rigid barrier with a 150 mm rounded edge |
| Intrusion flags | Structural rating guidelines [46] | Toe pan, brake pedal and lower hinge pillar flagged over 15 cm, the guidelines' bound for "good". The steering column is flagged over 10 cm, their bound for "acceptable" ("good" is 5 cm) |
| Side impact, barrier | The updated side test [47] | A 1,900 kg SUV-height barrier at 60 km/h (37 mph). The rating measures the space left between the B-pillar and the seat's centreline ("good" is over 18 cm); the lab flags B-pillar intrusion over 15 cm instead (a model threshold) |
| Side impact, pole | The side-impact standard's pole test [29] | A 254 mm rigid pole at 20 mph (32 km/h). The standard strikes at 75°; the lab strikes at 90° |
| Whiplash sled | The RCAR-IIWPG seat test [48] | A triangular sled pulse of 91 ms, as in the test (which peaks at 10 g for a Δv of 16 km/h); the lab scales Δv to half the striking car's speed. The T1 and head-restraint contact criteria |
| Pedestrian | Pedestrian AEB tests [49, 50]; head and leg limits [40, 41, 42] | Adult and child targets crossing ahead; braking times; HIC15, knee and tibia limits |
The approach
The car is driven on a kinematic bicycle model [51, 52], with L the wheelbase and δ the steering angle:
Pure-pursuit steering aims at a point L_d ahead on the approach line, α being its angle from the heading [53]:
The speed controller is a PID with the derivative on the measured speed and conditional integration, so the integral doesn't wind up while the force is saturated [54]:
Bullet-time, shake and sound
Bullet-time. ĝ is the crash pulse divided by its peak, widened and smoothed. The replay speed is a geometric blend between the fast speed s_f and 1/40×:
s_f is 1/4× until 97% of the pulse's impulse has gone by, then rises to 1× over 250 ms (model settings).
Shake grows with the deceleration, with decaying kicks for single events. It wobbles with three sines (23, 37 and 61 Hz) in replay time:
Game cameras often use a "trauma" value with shake ∝ trauma² and Perlin noise [63]. Here the deceleration itself plays the part of trauma.
Sound [57]:
Distance. Each sound plays through an HRTF panner with the inverse distance model (d_ref = 6 m, ρ = 0.7):
g(d) = \frac{d_\text{ref}}{d_\text{ref} + \rho\,\big(\max(d, d_\text{ref}) - d_\text{ref}\big)}
- Slow motion. The pitch follows the replay speed, r = clamp(s^0.25, 0.4, 1).
Structural groan. Its level follows the power the crash is absorbing, P = d(W_p + W_f + E_contact, damping, solver)/dt:
\ell = \min\!\left(1.3,\ \tfrac12 \log_{10} \frac{P}{100\ \text{kW}}\right)
- Distortion. It grows through a tanh waveshaper, tanh(k x)/tanh(k).
- Synthesis. These are procedural sounds shaped by the crash's own numbers. Physically based synthesis computes sound from a structure's vibration modes instead: modal sound [58, 59], thin shells [60], crumpling [61] and fracture [62]. See further reading.
- Frame k of the saved video is rendered at a replay time that advances by s(t)/30 per frame, so no frame depends on the computer's speed.
- The encoder waits while more than four frames are queued.
- The MP4 is written with its index first (fast start).
Bloom blurs the glow layer down a chain of half-size buffers and back up, a dual-filter blur [66].
The GPU solver
The springs are split by greedy graph colouring into groups that share no node. Each group is solved in parallel and the groups run in turn: a parallel Gauss-Seidel [10]. Car-against-car contacts are solved Jacobi-style from the same positions [5]. The kernels are written in WGSL [67].
Further reading
Methods from the research behind this section that the app doesn't use, and what each would take:
| Method | What it would add | What it would take |
|---|---|---|
| Stable neo-Hookean tetrahedra in XPBD [68] | A continuum material that keeps its volume, instead of springs | Tetrahedral meshes of the cars, and retuning every zone |
| Anisotropic shell plasticity [69] and ductile fracture [18, 19], with edge splitting | Panels that tear along lines instead of coming off whole | A shell mesh per panel and stresses through its thickness |
| GJK distance and contact [70] | Debris colliding with the car (a current limitation) | Convex hulls for the parts and the body |
| Position-based fluids [71], smoke on a grid [72], screen-space fluid rendering [73] | Coolant and oil spills, volumetric smoke and fire | A fluid solver and a volume renderer |
| Magic Formula tyres [55] | Tyre forces from slip during the approach and spins | Slip states per wheel. During the ~100 ms impact, Coulomb friction dominates |
| Modal, thin-shell and crumpling sound [58, 59, 60, 61, 62] | Sounds computed from the structure's vibration | Precomputed modes of each part |
| Learned surrogates [74, 75, 76] | Fast prediction of detailed FE deformation | Finite-element crash data to train on. They predict rather than explain |
Verification
node tools/headless-check.js all scenarios (about two minutes)
node tools/headless-check.js lexus a subset, by name fragment (rigid56, lab-, fire, ...)
The check runs the real modules in Node.
Scenarios:
- Lab sedan: 13 crashes (30–150 km/h, 30°, mass and stiffness variants, the brick wall at three strengths) and a standing-wall test.
- Lexus, Mustang and the garage's seven road cars: crashes at 30, 56, 100 and 150 km/h, at 30° and into the brick wall, in both damage modes. Also, for each, a parked car, a coasting car, a free wheel spinning at 130 rad/s and a wheel dropped while sliding; for the Lexus, the same crash at half the time step, and destruction on vs off.
It exits non-zero if any of these happens:
- a run produces NaN, gains energy (more than 3% above the initial kinetic energy) or never reaches the barrier;
- the wall can't stand on its own;
- a part coming off changes total momentum or energy;
- anything comes off at 30 km/h, or at 56 km/h in Realistic mode;
- nothing comes off, or no front tyre bursts, at 150 km/h;
- fewer than 3 parts come off, or no window breaks, in Dramatic mode at 100 km/h;
- a parked car moves or sheds parts; a coasting car slows by more than 5%;
- a free wheel loses spin, or a dropped wheel doesn't end up rolling;
- halving the step changes which parts come off, or their timing by more than 5 ms;
- destruction changes the peak deceleration or HIC by 3% or more.
Each crash lab is checked for the claim it makes:
- Overlap: the 25% small overlap intrudes more at the hinge pillar than the 40% moderate overlap, and the honeycomb crushes within its depth. In the small overlap, the intruding toe pan must push the dummy's left foot more than 5 cm further back than a fixed cabin would.
- Two vehicles: equal cars get equal Δv. A car of half the mass gets about twice the Δv (1.6–2.4×), while momentum holds over the first 30 ms.
- Side impact: the mild-steel B-pillar intrudes more than 15 cm and the hot-stamped one less, and the curtain airbag lowers HIC in the pole test.
- Whiplash: a well-placed head restraint passes both criteria, a 10 cm backset doesn't, and T1 acceleration rises with speed.
- Restraints: HIC falls from unbelted to plain belt to full restraints.
- Pedestrian: emergency braking avoids an adult at 25 mph and cuts a 37 mph impact by more than 40%, and the foam bumper lowers the leg's acceleration.
- Fire: a 56 km/h Lexus barrier test vents steam but doesn't catch fire; a 100 km/h one does.
Results at 56 km/h (rigid barrier, belt and airbag):
| Car | Crush | Peak (CFC 60) | HIC15 |
|---|---|---|---|
| Lab sedan | about 540 mm | 57 g | about 530 |
| Lexus RX 350 | about 580 mm | 69 g | about 560 |
| Ford Mustang GT500 | about 670 mm (long front overhang) | 36 g | about 310 |
The occupant runs in the check use the cabin's intrusion, as the app does.
node tools/gpu-check.js the GPU solver against the CPU (headless Chrome with WebGPU)
This runs the crashes in the tables above with both solvers. It fails if a GPU run errors or falls back to the CPU. It also fails if a result differs beyond its tolerance: for the barrier crashes, 6% on crush, 12% on peak deceleration, 3% on Δv and 8% on plastic energy; the labs have their own. It then times both solvers on the refined lattices. node tools/gpu-check.js honeycomb runs only the scenarios whose name contains that word.
The CPU solver is unchanged by the GPU option. With the GPU option off, eight crashes (the lab sedan, Lexus and Mustang, rigid barrier and brick wall, two angles) produce bit-identical frames, pulses, energies, debris and events to the version before it was added.
Design decisions
- Not real time during the impact. 60 FPS applies to the approach and playback. The impact is integrated at 0.1 ms, because 30–120 Hz can't resolve a ~100 ms crash pulse or give a valid HIC. A 2 s barrier crash takes about 1–2 s to compute, so the GPU or threads wouldn't make the wait noticeably shorter at this lattice size.
- 0.1 ms, not 1 ms. The SAE J211 filters pre-warp with tan(2π·2.0775·CFC·Δt/2). That only works while the argument stays below π/2, which needs Δt under about 0.24 ms for the head channel (CFC 1000) and 0.4 ms for the neck (CFC 600). At 1 ms the stiff lattice also gains energy.
- Plain JavaScript physics, with an optional GPU solver. The CPU solver is single-threaded, time-sliced on the main thread, and in 64-bit floats, so runs are bit-for-bit repeatable and the page works from a plain file. There is no WebAssembly or SharedArrayBuffer:
- shared memory needs cross-origin isolation headers, which a file opened from disk can't have;
- threads would make the summation order, and so the results, vary from run to run.
- WebGPU through plain WGSL, not three.js TSL. TSL compute needs three.js's
WebGPURenderer, which would mean loading a second copy of three.js next to the WebGL renderer the app draws with. Plain WebGPU compute keeps rendering on WebGL. - The GPU solver is opt-in. It is checked against the CPU solver rather than replacing it. It's slower at today's lattice size and faster on finer ones (see the GPU solver).
- No external physics library. Destruction follows the node-and-beam approach of BeamNG and Rigs of Rods, built on the same solver:
- ammo.js soft bodies have no plasticity;
- a second engine such as Rapier would split the solver and the energy books.
- Physics on the simulation nodes, not on render vertices. Material properties live in the lattice and
js/physics.js; the render mesh only follows it. - Two barrier modes. A rigid barrier, for injury numbers comparable with standard tests, and a breakable brick wall as a demonstration. A breaking wall absorbs energy and lengthens the crash, which lowers every injury number.
- Mass and stiffness are separate controls. Changing them together can cancel out.
- Speed range 10–150 km/h.
- The occupant is coupled one way. The 3D dummy is driven by the cabin pulse and pushed by the deforming interior, but its own forces don't act back on the car. That makes re-running it with other restraints instant (a few hundred milliseconds), and at 75 kg against 1.5–2 t the feedback would be small.
- Part-level fracture. Panels and wheels come off whole; the body structure itself doesn't tear. Bricks break at mortar joints only.
- Every run is computed. There are no pre-baked destruction caches.
- Kill switch per stage. It brakes during the approach and cancels during the computation. It isn't available during the ~100 ms impact itself.
- Colour-blind-safe heatmaps, no flashing. Status is always given as text too.
Limitations
- Not validated against physical crash tests. Numbers show trends between settings; they don't predict real injuries.
- Break limits are judgement calls, tuned to plausible outcomes:
- 30–56 km/h: lamps break, no panels or wheels come off;
- 100 km/h: the bumper, hood, fenders and front wheels come off, depending on the car;
- 150 km/h: most of the front comes off.
- Lab settings are judgement calls too. Steel strengths, honeycomb and trolley-face stiffness, padding, the curtain airbag, seat foam and sensor timings were tuned to give plausible numbers and the right trends. They aren't measured values.
- The lattice is a box-section approximation of each body. Its contact surface doesn't follow rounded corners exactly.
- The "contact, damping & solver" energy share is large, roughly 20–45%. In a real crash, most of that would be plastic work.
- Two cars: energy split. Once the crushed fronts interlock, friction and the solver residual trade energy back and forth. Their total stays right, so the lab shows them together as heat.
- Debris doesn't collide with the car after it comes off (it can pass through the body). Bricks don't collide with the interior.
- Glass shards are visual only. They don't collide with the car, and on the rigid barrier they stop at its face.
- Crumple folds and fire are visual.
- The folds are drawn where the lattice yielded; they don't add stiffness or change any number.
- Fire is a rule (engine driven 30 cm into the firewall), not a combustion model. It doesn't weigh how likely ignition is, how much fuel leaked, or fire spreading into the cabin.
- Real crash fires are much rarer than "every severe crash", so read it as "this crash could start a fire".
- Hoods and doors don't swing on their hinges before they come off.
- The imported interiors are removed. The app's own seat, wheel, airbag and dash are used, because the occupant model is built around them. The Lexus model has no engine, so a plain block stands in.
- Lab-only structure. The overlap lab's weaker cabin corners and the side lab's door-ring steel and hollow cabin are used in those labs only. The barrier tests' cars keep their uniform safety cell.
- Simplified dummies and braking.
- The 3D frontal dummy is a particle model with tuned joint springs, not a validated Hybrid III. Its arms are drawn holding the wheel but aren't simulated, and the lower legs give no tibia index. With the force limiter working properly it scores harsher than the earlier 2D dummy did (HIC about 560 against 360 for the Lexus at 56 km/h). The 2D dummy's limiter let the belt reach about 8 kN.
- The side-impact dummy works in one plane and leaves out the legs; in the side-impact lab it moves the 3D dummy segment by segment.
- The whiplash seat is generic.
- The pedestrian is a single 2D chain, so the arms and far leg only follow it in the 3D view.
- Emergency braking is a rule-based model of one system, not a particular product.
- The GPU solver doesn't cover everything. It covers every crash the labs set up, but not the brick wall. Parts don't come off and tyres don't burst, and friction heat isn't in its energy books. At today's lattice size it is slower than the CPU.
- Race.
- The crash solver works on flat ground, so a crash on a hill is drawn at the ground's height where it happened. On a slope or a ramp the wreck can sit a little into or above the surface. The kerbs are only drawn, not raised.
- Props touch each other only as spheres, and they don't land on cars: a falling street light can pass through a roof.
- Only your crashes run the lattice solver. Rivals and traffic wreck as rigid bodies, because the solver runs slower than real time during an impact, which is also why the crash camera is in slow motion.
- Very hard head-on hits (about 150 km/h and up, square into a wall) can tip the car onto its nose. That is the solver's own behaviour, also seen in the simulator's rigid-barrier test.
- Opponent driving is a set of rules (speed profile, pure pursuit, lane choice), not a learned driver.
- The touch controls, the phone layout of the car select and the driver's-seat camera were tested with simulated touches in desktop Chrome at phone sizes, not on a real phone; how smoothly the city runs on a phone isn't measured.
- Saving a video needs WebCodecs. The first time, it loads mp4-muxer from the CDN.
- Performance. The brick-wall computation takes several seconds on a laptop. The phone layout works but is cramped.