Skip to content

GridGraph

Defined in: GridGraph.ts:59

A grid graph with A* search. Coordinates in and out are world pixels.

new GridGraph(options): GridGraph

Defined in: GridGraph.ts:71

GridGraphOptions

GridGraph

readonly cols: number

Defined in: GridGraph.ts:60


readonly origin: Vec2

Defined in: GridGraph.ts:64


readonly rows: number

Defined in: GridGraph.ts:61


readonly tileHeight: number

Defined in: GridGraph.ts:63


readonly tileWidth: number

Defined in: GridGraph.ts:62

cellToWorld(col, row): Vec2

Defined in: GridGraph.ts:110

Tile centre, in world pixels.

number

number

Vec2


findPath(startWorld, goalWorld): Path | null

Defined in: GridGraph.ts:124

Start/goal are world pixels, converted via worldToCell. Returns null when either cell is out of bounds, or the goal cell isn’t walkable (the start cell may be blocked — an agent can straddle a blocked edge; only the goal must be walkable). Same start/goal cell returns a one-waypoint, zero-cost path regardless of that cell’s walkability.

Vec2Like

Vec2Like

Path | null


inBounds(col, row): boolean

Defined in: GridGraph.ts:98

number

number

boolean


worldToCell(v): GridCell

Defined in: GridGraph.ts:102

Vec2Like

GridCell