GridGraphOptions
Defined in: GridGraph.ts:17
Properties
Section titled “Properties”cols:
number
Defined in: GridGraph.ts:18
optionalcost?: (col,row) =>number
Defined in: GridGraph.ts:35
Per-cell multiplier on the step entering that cell. Default () => 1.
Must return a finite number; NaN or Infinity throws during
findPath. Must return >= 1 for optimal paths — the heuristic assumes
a minimum cell cost of 1, so sub-1 costs make it overestimate (a path is
still returned, just not guaranteed shortest).
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number
diagonalMovement?
Section titled “diagonalMovement?”
optionaldiagonalMovement?:DiagonalMovement
Defined in: GridGraph.ts:37
Default "no-corner-cutting".
heuristic?
Section titled “heuristic?”
optionalheuristic?:HeuristicName
Defined in: GridGraph.ts:39
Default: "octile" when diagonals are allowed, else "manhattan".
isWalkable
Section titled “isWalkable”isWalkable: (
col,row) =>boolean
Defined in: GridGraph.ts:27
Called on every findPath, never cached — a predicate whose result
changes between calls (a door opening) changes the next path with no
rebuild.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”boolean
origin?
Section titled “origin?”
optionalorigin?:Vec2Like
Defined in: GridGraph.ts:41
World-pixel position of cell (0,0)’s top-left corner. Default (0,0).
rows:
number
Defined in: GridGraph.ts:19
tileHeight
Section titled “tileHeight”tileHeight:
number
Defined in: GridGraph.ts:21
tileWidth
Section titled “tileWidth”tileWidth:
number
Defined in: GridGraph.ts:20