FERRETGame engine over Babylon.js
Ferret

Combustion and explosions

Skill ferret-physics-combustion-explosions · download all skills · SKILL.md

When to use#

A gun, a rocket, an engine, a boiler that can burst, a grenade, a crater, danger rings for a charge.

The model#

combustion models burning in a closed space and using the pressure: chambers, guns (fireGun), rockets (nozzle), engines, jets, boilers. explosions turns energy into blast: overpressure and impulse by scaled distance (blastAt, radiusFor), shielding by bodies, fragments and spall from a Casing, armour that stops them, craters (craterRadius, CraterLaw per soil), and vessels that burst (vesselTnt). Bodies get impulse I · A.

Steps#

  1. Enable explosion (and strength if bodies must break; terrain for craters).
  2. detonate({ at, tnt }) or { vessel: { pressure, volume, gamma }, burst, casing, seed }.
  3. Shield by putting a body between; set transmission; walls break by rupture.
  4. Guns and rockets: build the spec, fire, read peakPressure, muzzleVelocity; hand a burst's pressure and volume to detonate.
  5. Commands: explosion.detonate|info|preview, chamber.ignite, gun.fire, engine.start.

Check afterwards#

Eight times the charge gives twice the radius; rocket thrust rises with altitude by Δp_a · A_e; a barrel rated below peak pressure bursts.

What usually goes wrong#

  • Nothing moves: below minPressure at that distance, or shielded.
  • Nothing breaks: rupture is Infinity by default.
  • Wrong crater: no terrain, an air burst, or soil missing from craters.
  • ignite() false: outside flammability limits, no oxygen or fuel.
  • Different fragments each time: pass a seed.

Files#

  • reference/combustion.md — Burning in a closed space and using the pressure: guns, rockets, petrol and diesel engines, jets, boilers and gas cylinders that burst.
  • reference/explosions.md — Blast waves, shielding, craters, casings that throw fragments, armour that stops them, and vessels that burst.
  • reference/api-physics-combustion.md — every export of @ferret/physics-combustion with signature and doc comment
  • reference/api-physics-explosions.md — every export of @ferret/physics-explosions with signature and doc comment
  • reference/commands.md — 11 commands of these packages with their arguments
  • recipes/blasts-and-ground.md — Seven recipes: danger rings, a crater in sand and in rock, a charge buried too deep, a crater in a real terrain, a wall that shields, an underwater burst, a trench that holds or slumps.
  • recipes/tank-fire.md — A fire heats a sealed tank, the gas inside warms and its pressure climbs, the shell gives way and the tank becomes a blast with fragments that push a crate. Heat, links, gas, explosions and bodies in one loop.