Skip to content

GridGraph

Defined in: GridGraph.ts:35

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

new GridGraph(options): GridGraph

Defined in: GridGraph.ts:47

GridGraphOptions

GridGraph

readonly cols: number

Defined in: GridGraph.ts:36


readonly origin: Vec2

Defined in: GridGraph.ts:40


readonly rows: number

Defined in: GridGraph.ts:37


readonly tileHeight: number

Defined in: GridGraph.ts:39


readonly tileWidth: number

Defined in: GridGraph.ts:38

cellToWorld(col, row): Vec2

Defined in: GridGraph.ts:75

Tile centre, in world pixels.

number

number

Vec2


findPath(startWorld, goalWorld): Path | null

Defined in: GridGraph.ts:89

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:63

number

number

boolean


worldToCell(v): GridCell

Defined in: GridGraph.ts:67

Vec2Like

GridCell