Pathfind

Find the shortest path between two points on a navigation mesh.

What it does

Queries a named navigation mesh for the shortest route between a start point and an end point, returning that route as a polyline of waypoints. A corridor search runs across the mesh and the path is then pulled taut around corners, so the result hugs walls instead of zig-zagging through the middle of open floor.

Alongside the waypoint path it reports whether a path was found, the total length, and the number of waypoints, so logic can branch without inspecting the path itself.

When to use it

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

Gotchas

Start and end positions are 3D points, so this works across multi-level or sloped navigation meshes, not only flat 2D layouts.

Mesh Id is a plain name match, not a wired connection. It must be typed identically to the name set on the NavMesh Build node that built the mesh. A mismatch, even in case or spacing, means Pathfind is silently querying a mesh that does not exist.

Where no path exists between the two points, because the goal is unreachable or the mesh has not finished building, Found comes back as 0 and Path is empty. Check Found before trusting Path Length or Waypoint Count.

Worked example

  1. Build a navigation mesh first with NavMesh Build and give it a name.

  2. Add a Pathfind node and type that same name into Mesh Id.

  3. Wire the start and end points into Start Pos and End Pos.

  4. Check Found to confirm a route exists, then use Path to drive movement or Path Length / Waypoint Count for distance logic.

See also

NavMesh Build · Flow Field · query.physics_query · Points