---
title: "field"
description: "What a turning agent samples at its position: the magnetic field at the cursor, and its resting place on a jittered grid."
group: "simulation"
groupTitle: "Simulation"
categoryId: "sim.agentForces"
categorySlug: "sim-agentforces"
categoryTitle: "Agent forces"
kind: "object"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/sim/agentForces.ts#L1395"
---

# field

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

```ts
field: { dipoleOrRadial, jitteredGridHome }
```

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

## Example

```ts
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`](/docs/primitives/sim-agentforces/field-dipoleorradial) — The field of a magnet at the cursor: a bar magnet along its travel, or a single pole.
- [`field.jitteredGridHome`](/docs/primitives/sim-agentforces/field-jitteredgridhome) — Each agent's resting position on a jittered grid that runs past the canvas edges.

## See also

- [`torque`](/docs/primitives/sim-agentforces/torque) — The turns an agent that spins in place can feel, for `integrator.orientation2d`.
- [`integrator`](/docs/primitives/sim-agentforces/integrator) — The update step of an agent simulation: one per kind of agent.
- `agentFrame`