Skip to content

findPath

findPath(options): PathNode[] | null

Defined in: src/modules/pathfinding/pathfinding.ts:71

A* pathfinding on an abstract 2D grid.

Returns the ordered waypoints excluding the start and including the goal, or null if unreachable / the goal itself is not traversable. Returns an empty array when from equals to.

The algorithm is grid-agnostic: neighbor generation, edge cost, and traversability are all caller-supplied. Defaults match an 8-directional tile grid with 2 cardinal / 3 diagonal cost (so straight corridors are preferred over diagonal zigzags).

FindPathOptions

PathNode[] | null