Navigation · interface

NavEdge

Explained in Navigation.

interface NavEdge
import type { NavEdge } from '@driftengine/nav';

Properties

NameTypeDescription
fromreadonlynumber
toreadonlynumber
costreadonlyoptionalnumberWhat crossing it costs. Defaults to the distance between its ends.
More

A cost is not a distance and the difference is the whole of route quality. Mud, a hill, a toll, a road an agent should prefer, a corridor it should avoid unless there is nothing else: all of them are this number, and a consumer that never sets it gets shortest-path behaviour. The one rule the search depends on is that a cost is never less than the straight-line distance between the two ends — see navSearch, where the heuristic that makes A* exact assumes exactly that. Faster-than-flying edges are refused at build time rather than producing a route that is quietly not the best one.

bidirectionalreadonlyoptionalbooleanWhether it may also be crossed the other way. Default true.