DOCS // pyrofx

Forces

A spec takes any number of [[forces]], which act on the gas in a sphere, a box or everywhere: push, point, vortex, turbulence, drag and expand (a blast).

Contents5 sections
  1. Kinds
  2. Example
  3. Change the fan strength
  4. Fields
  5. Questions

Kinds

KindWhat it does
pushPushes along direction, like a fan.
pointAway from the center, or toward it with negative strength. Gas only.
vortexSpins gas around direction (right-hand rule).
turbulenceRandom gusts in one place.
dragSlows the gas: a still pocket behind a wall.
expandPushes everything outward: a blast. Keep it short, about 0.1 s.

Example

The fire whirl spins a ground fire into a column and pulls air in at its foot:

fire_whirl.pyro.toml (excerpt)
# The spin: around the vertical axis, up the whole column, on air and gas alike.
[[forces]]
kind = "vortex"
shape = "box"
position_m = [0, 4, 0]
size_m = [1.3, 4, 1.3]
direction = [0, 1, 0]
strength = 14
max_speed_mps = 4
falloff = 0.4

# Air drawn in at the foot, which is what keeps a real whirl narrow.
[[forces]]
kind = "point"
position_m = [0, 1.2, 0]
size_m = 2.0
strength = -6
falloff = 0.6
FIRE_WHIRLFINAL
First frame of the fire_whirl bake
Fire whirl, 4.4 x 7.1 m, compiled with Spatial Compiler. Spec →

Change the fan strength

Each setting pushes the same looping plume sideways with a different force. The two passes of a looping compile share one solver.

Compiled with Spatial Compiler. View the source spec forces.strength=0.01

Fields

FieldMeaningDefault
kindpush, point, vortex, turbulence, drag or expandpush
shapesphere, box or everywheresphere
position_mCenter of the region, of a point force and of a vortex (t)[0, 1, 0]
size_mRadius of a sphere; half-extents of a box (t)1.0
rotation_degTurns the region and its direction (t)[0, 0, 0]
falloffFade toward the edge, 0 to 1 (t); 0 is a hard edge0.5
strengthMeters per second gained each second (t); for drag and expand a rate per second. Negative reverses push, point, vortex and expand.10
directionWhich way a push pushes, or the axis of a vortex (t)[0, 1, 0]
max_speed_mpsStops adding speed to gas already this fast (t); 0 never stops0
acts_onall (air and gas, like a fan) or gas (clear air is left alone)all
start_s, end_sWhen it is on; end_s = 0 never stops0, 0

A push that piles gas against a wall cancels out, as in real air. expand always takes effect.

Questions

What kinds of forces can I add to a pyrofx spec?

You can add push, point, vortex, turbulence, drag and expand forces acting on a sphere, a box or everywhere.

What is the difference between acts_on all and gas in pyrofx forces?

Setting acts_on to all affects both air and gas like a fan, while gas leaves clear air alone.

Why does a push force against a wall stop moving gas in pyrofx?

A push that piles gas against a wall cancels out like real air, whereas expand always takes effect.