Navigation · function

buildNavGraph

Build the graph, checking the two things that make a wrong route look like a working one.

Explained in Navigation.

function buildNavGraph(positions: Float32Array | readonly number[], edges: readonly NavEdge[]): NavGraph
import { buildNavGraph } from '@driftengine/nav';

Parameters

ParameterTypeDescription
positionsFloat32Array | readonly number[]
edgesreadonly NavEdge[]

In depth

An edge naming a node that does not exist, and an edge cheaper than flying: both produce a graph that searches happily and answers wrongly, one by reading past the end of an array and one by breaking the admissibility A* needs. Refused here, at build time, which is where this engine refuses things.