FERRETGame engine over Babylon.js
Ferret

Media acting on materials

Skill ferret-physics-response · download all skills · SKILL.md

When to use#

A model with fans or rotors hovers over grass, sand, a pond or a lawn of leaves and the ground must answer; a jet or a river must move what it meets.

The model#

A model declares physics.propulsors; bindPropulsors publishes its jets (and the wall jet over a surface) into the flow field. Everything else only reads the field: FlowMap for plants, airOnWater for water, GroundWash, BedWash, FlakePool, physics-media for bodies, physics-stretch for cloth, jetFlux / snowMelted for heat. A model that declares no propulsors changes nothing.

Steps#

  1. Declare physics.propulsors in the model (kind, position, axis, diameter, optional hoverShare, medium).
  2. const props = bindPropulsors(actor, { field, surface }); call props.update() once a step.
  3. Plants: const map = new FlowMap(), map.update(field, camX, camZ, t, budget.mapStride) each frame, pass flowMap: map to the grass views and the foliage-wind plugin.
  4. Water: surface.forcing(airOnWater(field, surface, t, { publisher: 'physics-response' }), budget.waterStride) before surface.step; SprayEmitter for spray; impactOnWater for falls.
  5. Ground and bed: GroundWash.step(dt, at) / BedWash.step(dt, at) with the grains of your ground; apply dh to your height field; dust from the returned events.
  6. Add ResponseBudget to the world so the quality regulator can give detail up.

Check afterwards#

Shots from examples/response on the NVIDIA card (tools/physics-response/sample-shot.mjs); the laws are tested in packages/physics-response/test; tools/physics-response/gpu-check.mjs checks the shader forms.

What usually goes wrong#

  • Nothing blows: the model has no propulsors, the actuator is off (no hover fallback then), or scale is 0.
  • The grass does not lean: the view was made without flowMap, or the map's centre is not near the source.
  • Water does not dent: forcing not called each step, or the field is asked for the weather's wind too (publisher limits it).
  • A dust ring shows no pit: the height change is millimetres at real scale; judge it by dh, not by eye.
  • WebGPU shows nothing: use the full Chromium; Ferret's GLSL shaders need createGameAsync.

Files#