
Path finder utilitiy. To use it:
IGrid instance that returns if a grid node is blocking and what's the price to cross it.Array.<Vector2>Find a path between start to target.
Get distance between two points on grid. This method is quick and dirty and takes diagonal into consideration.
Interface for a supported grid.
Kind: global class
BooleanNumberBooleanCheck if a given tile is blocked from a given neihbor.
Kind: instance method of IGrid
Returns: Boolean - Can we travel from _from to _to?
| Param | Type | Description |
|---|---|---|
| _from | Vector2 | Vector3 |
Source tile index. |
| _to | Vector2 | Vector3 |
Target tile index. Must be a neighbor of _from. |
NumberGet the price to travel on a given tile. Should return 1 for “normal” traveling price, > 1 for expensive tile, and < 1 for a cheap tile to pass on.
Kind: instance method of IGrid
Returns: Number - Price factor to walk on.
| Param | Type | Description |
|---|---|---|
| _index | Vector2 | Vector3 |
Tile index. |
A path node.
Kind: global class
Create the node from a position.
| Param | Type | Description |
|---|---|---|
| position | Vector2 | Vector3 |
Node position. |
Get the node fCost factor.
Kind: instance property of Node
Path finder utilitiy. To use it:
IGrid instance that returns if a grid node is blocking and what’s the price to cross it.Array.<Vector2>Find a path between start to target.
Kind: global function
Returns: Array.<Vector2> - List of tiles to traverse.
| Param | Type | Description |
|---|---|---|
| grid | IGrid |
Grid provider to check if tiles are blocked. |
| startPos | Vector2 | Vector3 |
Starting tile index. |
| targetPos | Vector2 | Vector3 |
Target tile index. |
| options | \* |
Additional options: { maxIterations, ignorePrices, allowDiagonal } |
Get distance between two points on grid. This method is quick and dirty and takes diagonal into consideration.
Kind: global function