Navigation · function
nearestPoly
The polygon a point is in, or the nearest within extent. -1 beyond it. The point and the
extent are in metres, which the mesh's placement turns into its cells.
Explained in Navigation.
function nearestPoly(mesh: PolyMesh, x: number, z: number, extent: number): numberimport { nearestPoly } from '@driftengine/nav';Parameters
| Parameter | Type | Description |
|---|---|---|
mesh | PolyMesh | |
x | number | |
z | number | |
extent | number |
In depth
-1 rather than the nearest whatever the distance, because an agent asked to walk to a
place that is not on the mesh has to be told. Snapping across the map produces a path to
somewhere nobody asked for, which is worse than no path at all.