field

What a turning agent samples at its position: the magnetic field at the cursor, and its resting place on a jittered grid.

field: { dipoleOrRadial, jitteredGridHome }

Import sim from shaders/std and use sim.agentForces.field.

Example

integrator.orientation2d(simLayout, {home: field.jitteredGridHome(simLayout, {overscan: 0.1}), fieldAt: field.dipoleOrRadial(simLayout), torques: [torque.alignToField(simLayout), torque.rest(simLayout)], maxOffset: 0.02, name: 'filingsUpdate'})

Members

  • field.dipoleOrRadial — The field of a magnet at the cursor: a bar magnet along its travel, or a single pole.
  • field.jitteredGridHome — Each agent's resting position on a jittered grid that runs past the canvas edges.

See also

  • torque — The turns an agent that spins in place can feel, for integrator.orientation2d.
  • integrator — The update step of an agent simulation: one per kind of agent.
  • agentFrame