Navigation · interface
PortalGraph
Explained in Navigation.
interface PortalGraphimport type { PortalGraph } from '@driftengine/nav';Properties
| Name | Type | Description |
|---|---|---|
graphreadonly | NavGraph | Nodes: one per portal, then the start, then the goal. |
portalCountreadonly | number | |
sidesreadonly | Int32Array | The two polygons each portal joins, near first: 2 per portal. |
endsreadonly | Int32Array | The portal's two vertices as each of its polygons stores them: 4 per portal, near's pair
then far's.MoreBoth, rather than one pair flipped when the path crosses the other way. The funnel needs the left end and the right end for the direction of travel, and which vertex is which depends on the winding of the polygon being left — a mesh whose two polygons do not store a shared edge in opposite orders would silently get the funnel's two sides swapped, which is a legal path and a visibly worse one. Read at build time from both sides, so nothing assumes. |
polyStartreadonly | Uint32Array | Which portals a polygon has: polyStart[p] to polyStart[p + 1] into polyPortals. |
polyPortalsreadonly | Uint32Array | |
startNodereadonly | number | |
goalNodereadonly | number | |
goalSlotreadonly | Uint32Array | The edge slot each portal keeps for the goal, and the range the start node's slots occupy. |
startSlotsreadonly | Uint32Array | |
attachedGoal | number | The polygon whose portals currently point at the goal, or −1. |