Log inGet started
Package

crashCars.package

This package holds more than this page lists. See all of its files in its world.

README.md

CrashCar

The crush of a crashCars car. Cars.spawn puts it on the chassis entity, which must carry a dynamic Physics body; it needs the car's SoftBody shell entity (field shell) and the bumper / bonnet children the spawn creates. It is not meant to be added by hand.

On the peer that simulates the car it runs the lane model every physics step: three lanes per face (front, rear, left, right) cast rays from inside the body, push the car (and a dynamic or soft obstacle) with that lane's share of Cars.crushForce for its crush depth, never more than stops the closing speed, give back reboundShare of the impact speed, and grow the lane's depth as the obstacle moves in. It writes the lane depths into the shell's crush zones (positions and rest shape, so the dent stays and replicates), slides the bumper back and folds the bonnet up, and tears them off as loose synced bodies past bumperOffAt / bonnetOffAt. energyJ is the work the crush forces did on the closing motion.

Methods: :measureCrush(face), :worstFace(), :track(on, face), :settle(face), :setExclude(ids), :brake(torque), :repair(). Synced fields include crushMax, crushResidual, lanes, energyJ, peakForceN, detached, looseBumper, looseBonnet, ready. Events: onPartDetached { part }, onImpact { face, speed, target }.