Expand description
Grid navigation: A* paths, line-of-sight smoothing, path following and distance fields over caller-owned 2D grids.
Searches read cells through NavGrid, so tilemaps, voxel layers and game
arrays can be searched in place without copying. PathFinder and
DistanceField keep their buffers between queries: once their capacity
covers the grid, queries do not allocate. GridLayout maps cells to world
positions for PathFollower and collision geometry.
Moving into a cell costs that cell’s NavGrid::cost multiplied by the
step length: 1 orthogonally and √2 diagonally. The start cell’s cost is
never charged. Results are deterministic for the same grid and inputs.
Structs§
- Cost
Grid - Owned row-major grid of per-cell costs.
- Distance
Field - Cost from every cell to the nearest of one or more goals (a Dijkstra map).
- GridFn
- Adapts a size and cost callback to
NavGridwithout storing cells. - Grid
Layout - Maps grid cells to world-space cells.
- Path
Finder - Reusable A* search state for grids up to the largest size seen.
- Path
Follower - Steers a character through world-space waypoints.
- Path
Options - A* search settings.
Enums§
- Diagonal
Rule - Rule for diagonal moves past the two orthogonally adjacent cells.
- Neighborhood
- Cells reachable in one step.
- Path
Error - Invalid navigation input.
- Path
Status - Result of an A* call.
Traits§
- NavGrid
- Read-only access to a bounded navigation grid.
Functions§
- line_
of_ sight - Whether a straight segment between two cell centers crosses only walkable cells.
- smooth_
path - Removes waypoints that a straight segment can skip, in place.