Navigation & pathfinding

Steer crowds toward a goal, or route a single agent through a space — DNA gives you two complementary tools for getting things to move intelligently.

Navigation answers one question: given where I am and where I want to go, which way do I move? DNA solves it two ways. A Flow Field bakes the answer into the whole space at once — perfect for many agents heading for a shared goal. NavMesh Build + Pathfind computes an exact route between two points — perfect when one agent needs a precise path.

Flow Fields — steering for crowds

A simulation.flow_field turns your space into a grid where every cell stores a little arrow pointing toward the goal along the cheapest route around obstacles. Any agent just reads the arrow under its feet and moves that way — no per-agent searching, so it scales effortlessly to thousands of movers. This is the go-to for boids, crowds, and swarm behaviour.

You feed it two things: obstacles and a goal. Obstacles can be a raster (dark pixels are walls) or a collection of geometry that fills the cells it covers. The goal is a single point or many points. Set the grid's world bounds and resolution, then sample the resulting field from your agents — typically inside a Particle sim or an field-driven Expression.

ParameterTypeDefault
obstaclesOneOf([FieldOf(Color), Collection])
goalOneOf([Vec3, Vec3Array, Collection])
bounds_minOneOf([Vec3])
bounds_maxOneOf([Vec3])
resolutionNumber64
diagonalBooleantrue
thresholdNumber0.500
rasterizeBooleanfalse
raster_widthNumber512
raster_heightNumber512
opacityNumber1

The node also gives you a cost field output — the distance-to-goal at every cell — which is handy for colouring, fading, or gating behaviour by how far an agent still has to travel.

Flow Fields shine when everyone wants the same destination. Move the goal point and the whole crowd re-steers live. For per-agent destinations, reach for Pathfind instead.

Building a NavMesh

A navigation mesh is a simplified map of the walkable surface — the floor, minus walls, ledges too steep to climb, and gaps too narrow to fit through. simulation.navmesh_build generates one automatically from your scene geometry.

It works by filling your geometry into a volume, shrinking the walkable area inward by the agent's radius (so paths never hug walls too tightly), then carving the result into connected walkable regions. You give the mesh a name so a Pathfind node can find it later.

ParameterTypeDefault
geometryOneOf([Collection])
mesh_idString"default"
agent_radiusNumber0.600
agent_heightNumber2
max_slopeNumber45
max_climbNumber0.900
resolutionNumber64
bounds_sizeNumber100
opacityNumber1

The Agent settings describe who's walking: how wide they are, how tall (for clearance under low ceilings), the steepest slope they'll climb, and the tallest step they'll take. Higher resolution captures finer detail at the cost of more cook time.

The agent radius is the most important knob to get right. Too small and agents clip through corners; too large and narrow doorways vanish from the mesh entirely. Tune it to match the size of whatever is actually moving.

Pathfinding

simulation.pathfind queries a named NavMesh and returns the shortest route between a start and an end point. Point its mesh name at the same name you gave NavMesh Build, wire in the two positions, and it hands back a clean path.

ParameterTypeDefault
mesh_idString"default"
start_posOneOf([Vec3])
end_posOneOf([Vec3])
opacityNumber1

The main path output is a points polyline — a tidy line of waypoints you can render, follow, or feed into another node. Alongside it you get found (did a route exist at all?), the total path length, and the waypoint count. Drive an agent along the path, or use found to trigger fallback behaviour when somewhere is unreachable.

Animate the start or end position and the path recomputes every cook — drag a goal around the viewport and watch the route snake to follow it.

Which one do I want?

Both can coexist — a flow field for the herd, a pathfind for the hero.

See also