API reference
Every public class, method, and event in @codexo/exojs. Generated from source.
classGridSpace
A rectangular window of weighted, optionally blocked cells. The window is finite by construction: everything outside it is blocked, so a search always terminates and an infinite or streamed world is served by sizing the window to the region the actors are in, then feeding chunk changes back through setCost. Coordinates in the public API are absolute cell coordinates - the same numbers a tilemap uses - not offsets into the window. Cost `0` blocks a cell, `1` is ordinary ground and larger values are terrain an agent will route around when it is cheaper to do so. Diagonal steps cost their length, so the metric stays consistent with the octile heuristic. The space carries no scene node and no rendering: it is data plus a neighbour relation, and it is built and mutated entirely by the application.
import { GridSpace } from '@codexo/exojs-pathfinding'A rectangular window of weighted, optionally blocked cells.
The window is finite by construction: everything outside it is blocked, so a search always terminates and an infinite or streamed world is served by sizing the window to the region the actors are in, then feeding chunk changes back through setCost. Coordinates in the public API are absolute cell coordinates - the same numbers a tilemap uses - not offsets into the window.
Cost `0` blocks a cell, `1` is ordinary ground and larger values are terrain an agent will route around when it is cheaper to do so. Diagonal steps cost their length, so the metric stays consistent with the octile heuristic.
The space carries no scene node and no rendering: it is data plus a neighbour relation, and it is built and mutated entirely by the application.
new(width: number, height: number, options: GridSpaceOptionsConstruction options for GridSpace.): GridSpaceclearanceAt(x: number, y: number): numbercostAt(x: number, y: number): numberheuristic(node: number, goal: number): numberisWalkable(x: number, y: number): booleannearestNode(x: number, y: number): numberneighbors(node: number, agentSize: number, outNodes: Int32Array, outCosts: Float64Array): numbernodeAt(x: number, y: number): numbernodeX(node: number): numbernodeY(node: number): numberpointToNode(x: number, y: number): numbersetCost(x: number, y: number, cost: number): voidsmoothPath(nodes: readonly number[], agentSize: number): number[]from(width: number, height: number, cost: (x: number, y: number) => number, options: GridSpaceOptionsConstruction options for GridSpace.): GridSpacecellOriginX: numbercellOriginY: numbercellSize: numberheight: numbermaxDegree: numberoriginX: numberoriginY: numberwidth: numbernodeCapacity: numberrevision: numberuniformCost: boolean