integrator.steering2d

A flock under summed steering, kept cruising, arcing off the canvas edges.

integrator.steering2d(layout: SteeringLayout, cfg: {
    forces: AgentSteer2[]
    /** Excitement: effort above `rest` (in max-force units) charges by `gain`, and cools at `cool` per second. */
    agitation: {rest: number; gain: number; cool: number}
    /** Slowest cruise, as a fraction of each agent's top speed. */
    cruiseFloor: number
    /** Speed kept when an agent bounces off an edge (0–1). */
    wallRestitution: number
    name: string
}): (i: number) => void

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

Parameters

NameTypeNotes
layoutSteeringLayout
cfg`{
forces: AgentSteer2[]
/** Excitement: effort above `rest` (in max-force units) charges by `gain`, and cools at `cool` per second. */
agitation: {rest: number; gain: number; cool: number}
/** Slowest cruise, as a fraction of each agent's top speed. */
cruiseFloor: number
/** Speed kept when an agent bounces off an edge (0–1). */
wallRestitution: number
name: string

}` | |

Example

integrator.steering2d(simLayout, {forces: [force.flocking(simLayout, {maxAgents: 4096}), force.cursorSteer(simLayout), force.wallTurn(simLayout)], agitation: {rest: 1.5, gain: 0.45, cool: 1.3}, cruiseFloor: 0.35, wallRestitution: 0.6, name: 'boidsUpdate'})

See also

  • force.flocking — Separation, alignment and cohesion for a flock, with live weights and radii.