five-on-it / packages/sim/src/breakables
packages/sim/src/breakables
The light pieces of a level: the placements with a breakable mass (a hydrant, a street lamp, a traffic light, a bench). Planted, each stands on a fixed body of its own and stops a car like any prop. A car (or trailer) about to hit one with LOOSEN_ENERGY or more kinetic energy (a mid-size sedan's at 60 km/h: a bus has it at a crawl, a bicycle never) knocks it loose just before the step: it becomes a body of its own mass, colliding as the convex hull of its mesh (a planted lamp collides as its pole and arm, so a car passes under the arm), and the step lets the car push it away and drive on, slowed by what it pushed. A level reset, or the server's word on a client, plants it again where it stood.
A piece is an entity of its own (Piece: its placement's index and whether it is loose), created with the world in placement order, so the server's and the client's are the same.