integrator.forces3d

A 3D swarm under summed forces, with drag, a speed limit and a position clamp.

integrator.forces3d(layout: VolumeSwarmLayout, cfg: {
    forces: AgentForce3[]
    maxSpeed: number
    posClamp: number
    name: string
}): (i: number) => void

Import sim from shaders/std and use sim.agentForces.integrator.forces3d.

Parameters

NameTypeNotes
layoutVolumeSwarmLayout
cfg`{
forces: AgentForce3[]
maxSpeed: number
posClamp: number
name: string

}` | |

Example

integrator.forces3d(simLayout, {forces: [pressure.force, force.containment(simLayout, containmentCfg), force.cursorXY(simLayout), force.gravity(simLayout)], maxSpeed: 3, posClamp: 1.9, name: 'swarmUpdate'})

See also

  • force.pressure — Spread a 3D swarm evenly by pushing agents away from crowded cells of a density grid.
  • force.containment — Keep a 3D swarm inside a shape: a spring at the surface, a pull back from far away, and a drag when the shape rotates.