force.turbulence

A per-agent jitter that keeps a 3D swarm alive, scaled by params.agitation.

force.turbulence(
  layout: VolumeSwarmLayout,
  cfg: {posScale: number; timeX: number; timeY: number; seedScale: number; gain: number},
): AgentForce3

Import sim from shaders/std and use sim.agentForces.force.turbulence.

Parameters

NameTypeNotes
layoutVolumeSwarmLayout
cfg{posScale: number; timeX: number; timeY: number; seedScale: number; gain: number}

Example

forces: [pressure.force, force.turbulence(simLayout, {posScale: 193, timeX: 31.7, timeY: 27.3, seedScale: 997, gain: 5})]

Tip. Keep the scale constants large. Small ones make the noise smooth and the whole swarm drifts in step.

See also

  • force.cursorXY — The cursor as a magnet on a 3D swarm, pushing away (or pulling in when the force is negative).