entrainmentFromOmega
The values force.containment reads for a rotating shape: the rotation rate capped at cap, and an entrain gain that grows with the rate up to gainMax.
entrainmentFromOmega(
om: {x: number; y: number; z: number},
opts: {cap: number; gainRate: number; gainMax: number},
): { omegaX: number; omegaY: number; omegaZ: number; entrain: number; }
Import sim from shaders/std and use sim.agentFrame.entrainmentFromOmega.
Parameters
| Name | Type | Notes |
|---|---|---|
om | {x: number; y: number; z: number} | |
opts | {cap: number; gainRate: number; gainMax: number} |
Example
const {omegaX, omegaY, omegaZ, entrain} = agentFrame.entrainmentFromOmega(om, {cap: 10, gainRate: 2.5, gainMax: 5})
Tip. With a still shape the gain is exactly 0, so the entrainment force costs nothing to leave declared.
See also
omegaFromRotationDeltas— How fast a rotating shape's surface moves, from its rotation this frame and last frame, so a swarm inside it can be dragged along.force— The pushes an agent can feel.