five-on-it / packages/sim/src/breakables / loosenStruckPieces
Function: loosenStruckPieces()
loosenStruckPieces(
sim):void
Defined in: packages/sim/src/breakables.ts:304
Knocks loose every planted piece a car or a trailer is about to hit with LOOSEN_ENERGY or more kinetic energy (½·m·v², the rig's mass at the speed of the body that strikes; its hull cast along its velocity for two ticks), the first it would hit each tick, recording a break event at the car (its driver's client as the owner). Runs before the physics step, so the step sees the piece loose and the car pushes it instead of stopping. The pieces within that reach are looked up on a grid of the ground and the hull is cast at each of them alone, so a street of fast traffic costs a few lookups a car and a cast where a lamp stands by the kerb, never a search of the whole level.
Parameters
sim
Returns
void