FERRETGame engine over Babylon.js
Ferret

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#

  1. Enable strength; set toughness (N·s absorbed), threshold, pieces, burst at world, level, zone or entity scope.
  2. Per-kind toughness: config('strength').set('entity', 'toughness', 3, 'glass-pane').
  3. Joints: cap.joint(...) after enabling; listen for physics:joint-break.
  4. Designed pieces: fractured in the level's physics block (edit.physics.fracture.set).
  5. Multiplayer: pass the owner's BreakEvent.seed to breakNow on 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: threshold 0 so resting contact accumulates.
  • Break event but no pieces: pieces 0, maxPieces used 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-strength with signature and doc comment
  • reference/commands.md — 2 commands of these packages with their arguments
  • recipes/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.