RexBoard Grids And Coordinates
Use this skill for RexBoard coordinate systems and board geometry. It covers quad/hex grid creation, tile/world conversion, neighbor directions, and shape-to-tile queries.
Use This First
Pick the grid factory before writing board logic:
| Need |
Use |
| Orthogonal square/rect board |
quadGrid with type: 'orthogonal' |
| Isometric diamond board |
quadGrid with type: 'isometric' |
| Hex board |
hexagonGrid with staggeraxis and staggerindex |
Then pass the grid into this.rexBoard.add.board({ grid, width, height }) or new Board(scene, { grid, width, height }).
Required Setup
This skill assumes RexBoard is available as this.rexBoard or through direct imports from board-components.js. If not, use rexboard-setup-and-factory.
References
Read these only when needed:
references/grid-config.md: quad/hex config fields and embedded board grid configs.
references/coordinate-conversion.md: getWorldXY, getTileXY, board conversion, bounds, and shape queries.
references/directions-and-neighbors.md: direction indexes, neighbor APIs, range queries, and quad/hex direction notes.
references/grid-recipes.md: reduced recipes for orthogonal, isometric, hex, and pointer-to-tile patterns.
Core Rules
- A
Board delegates coordinate conversion to its grid.
- Prefer board conversion methods after a board exists:
tileXYToWorldXY, worldXYToTileXY, and worldXYSnapToGrid.
- Use raw grid methods only for grid-only work:
grid.getWorldXY, grid.getTileXY, grid.getGridPoints, and grid.getBounds.
- Quad
dir: '4dir' versus dir: '8dir' changes neighbor directions.
- Hex
staggeraxis and staggerindex affect both visual layout and adjacency.
- Direction indexes depend on grid mode. Avoid hard-coding semantic names unless the grid mode is fixed.
Source File Map
plugins/board/grid/quad/Quad.d.ts: quad grid config and conversion methods.
plugins/board/grid/hexagon/Hexagon.d.ts: hex grid config and conversion methods.
plugins/board/board/LogicBoard.d.ts: board-level conversion, bounds, neighbors, ranges, and shape queries.
plugins/board/grid/quad/Factory.js: quadGrid factory signature.
plugins/board/grid/hexagon/Factory.js: hexagonGrid factory signature.
Related Skills
rexboard-setup-and-factory: plugin setup and factory discovery.
rexboard-components-catalog: choose a board component family.
rexboard-board-and-chess: board construction, tileZ, occupancy, and input events.
rexboard-map-generation-and-import: generated hex map coordinate sets.
Gotchas
wrap and infinity are board settings, not grid settings, but they change neighbor and bounds behavior.
tileX/tileY identify grid coordinates; chess placement also needs tileZ.
- Shape-to-tile queries return tile coordinate arrays, not chess objects.
1---2name: rexboard-grids-and-coordinates3description: Use this skill when working with RexBoard grid coordinates, quadGrid, hexagonGrid, tileXY, worldXY, tile-to-world conversion, world-to-tile conversion, orthogonal, isometric, staggeraxis, staggerindex, direction indexes, neighbor tiles, or board grid shape queries. Triggers on: RexBoard grid, rexBoard quadGrid, rexBoard hexagonGrid, tileXY, worldXY, getWorldXY, getTileXY, RexBoard direction, RexBoard neighbors.4---56# RexBoard Grids And Coordinates78Use this skill for RexBoard coordinate systems and board geometry. It covers quad/hex grid creation, tile/world conversion, neighbor directions, and shape-to-tile queries.910## Use This First1112Pick the grid factory before writing board logic:1314| Need | Use |15|---|---|16| Orthogonal square/rect board | `quadGrid` with `type: 'orthogonal'` |17| Isometric diamond board | `quadGrid` with `type: 'isometric'` |18| Hex board | `hexagonGrid` with `staggeraxis` and `staggerindex` |1920Then pass the grid into `this.rexBoard.add.board({ grid, width, height })` or `new Board(scene, { grid, width, height })`.2122## Required Setup2324This skill assumes RexBoard is available as `this.rexBoard` or through direct imports from `board-components.js`. If not, use `rexboard-setup-and-factory`.2526## References2728Read these only when needed:2930- `references/grid-config.md`: quad/hex config fields and embedded board grid configs.31- `references/coordinate-conversion.md`: `getWorldXY`, `getTileXY`, board conversion, bounds, and shape queries.32- `references/directions-and-neighbors.md`: direction indexes, neighbor APIs, range queries, and quad/hex direction notes.33- `references/grid-recipes.md`: reduced recipes for orthogonal, isometric, hex, and pointer-to-tile patterns.3435## Core Rules3637- A `Board` delegates coordinate conversion to its `grid`.38- Prefer board conversion methods after a board exists: `tileXYToWorldXY`, `worldXYToTileXY`, and `worldXYSnapToGrid`.39- Use raw grid methods only for grid-only work: `grid.getWorldXY`, `grid.getTileXY`, `grid.getGridPoints`, and `grid.getBounds`.40- Quad `dir: '4dir'` versus `dir: '8dir'` changes neighbor directions.41- Hex `staggeraxis` and `staggerindex` affect both visual layout and adjacency.42- Direction indexes depend on grid mode. Avoid hard-coding semantic names unless the grid mode is fixed.4344## Source File Map4546- `plugins/board/grid/quad/Quad.d.ts`: quad grid config and conversion methods.47- `plugins/board/grid/hexagon/Hexagon.d.ts`: hex grid config and conversion methods.48- `plugins/board/board/LogicBoard.d.ts`: board-level conversion, bounds, neighbors, ranges, and shape queries.49- `plugins/board/grid/quad/Factory.js`: `quadGrid` factory signature.50- `plugins/board/grid/hexagon/Factory.js`: `hexagonGrid` factory signature.5152## Related Skills5354- `rexboard-setup-and-factory`: plugin setup and factory discovery.55- `rexboard-components-catalog`: choose a board component family.56- `rexboard-board-and-chess`: board construction, `tileZ`, occupancy, and input events.57- `rexboard-map-generation-and-import`: generated hex map coordinate sets.5859## Gotchas6061- `wrap` and `infinity` are board settings, not grid settings, but they change neighbor and bounds behavior.62- `tileX`/`tileY` identify grid coordinates; chess placement also needs `tileZ`.63- Shape-to-tile queries return tile coordinate arrays, not chess objects.