Strength and breaking
Skill ferret-physics-strength · download all skills · SKILL.md
When to use#
A crate that breaks at speed, a rope or rod with a rating, a wall that falls in designed pieces, debris limits.
The model#
Damage is the impulse above a threshold: a gentle brush does nothing, a hard hit breaks the body into pieces (capped by the tier's maxPieces). cap.joint({ type: 'rod', a, b, maxForce }) breaks at a force. The default toughness is infinite: nothing breaks until you set it. Events: physics:break, physics:joint-break.
Steps#
- Enable
strength; settoughness(N·s absorbed),threshold,pieces,burstat world, level, zone or entity scope. - Per-kind toughness:
config('strength').set('entity', 'toughness', 3, 'glass-pane'). - Joints:
cap.joint(...)after enabling; listen forphysics:joint-break. - Designed pieces:
fracturedin the level'sphysicsblock (edit.physics.fracture.set). - Multiplayer: pass the owner's
BreakEvent.seedtobreakNowon remote copies.
Check afterwards#
A 3 N·s hit leaves a 10 N·s crate whole and a 20 N·s hit breaks it in the number of pieces set; two parallel rods fail weakest first.
What usually goes wrong#
- Nothing breaks: toughness still infinite at that scope.
- Breaks from a touch:
threshold0 so resting contact accumulates. - Break event but no pieces:
pieces0,maxPiecesused up, or (light kernel) the body is not a sphere. - Load design: two rods share a load; the weaker goes and the stronger inherits it (
recipes/progressive-collapse.md).
Files#
reference/strength.md— Bodies that take damage from hard hits and break into pieces, links that break at the force their material holds, pre-fractured walls, the piece budget and replication by seed.reference/api-physics-strength.md— every export of@ferret/physics-strengthwith signature and doc commentreference/commands.md— 2 commands of these packages with their argumentsrecipes/structures-and-ropes.md— Six recipes: a rope that holds a load or snaps, a shear pin that protects the rest, a crate that breaks only at speed, a bungee that springs back, a wall that breaks under a blast, a curtain that hangs.recipes/progressive-collapse.md— Two parallel hangers share a load. When the weaker one goes the stronger one inherits all of it and fails too: progressive collapse, with redundancy as the cure.