Move a pawn on a hex board
What this teaches
This scene combines a hexagonal topology, structure selection, occupancy-aware action previews, and precise World 3D hit resolution. Its moves are still ordinary transactions applied by GridActionRunner.
Open and run
Menu path: Tools > Lost Lily > Grid Toolkit > Samples > Open > Hex Pawn Movement.
Enter Play Mode. Click a pawn to select it, then click one highlighted destination. Use Reset to rebuild the authored setup.
Try it
- Click the pawn.
- Read the green neighboring destinations around it.
- Point at a non-highlighted or occupied cell and compare the feedback.
- Click a valid highlighted destination.
- Select the pawn again and make a second move.
Checkpoint
Only legal neighboring cells are highlighted. A valid click moves the pawn into exactly the cell resolved by the World 3D hit. Invalid targets leave the state unchanged. Reset restores the authored pawn position.
How it works
| Scene part | Public system | Responsibility |
|---|---|---|
| Hex board | HexGridCoordinate and topology | Defines neighbors and coordinate identity. |
| Selection session | Project interaction code | Tracks the selected pawn and candidate destinations. |
| Move preview | GridActionRunner |
Applies occupancy and placement checks without mutation. |
| World 3D view | GridBoardView | Resolves the pointer to one grid hit. |
Try another variation
In a duplicated scene, add an obstacle, change the starting position, or alter the permitted neighbor range.
Troubleshooting
| Symptom | Fix |
|---|---|
| No destinations appear. | Select the pawn first and check the status message. |
| A click selects the wrong place. | Confirm the World 3D camera and hit surfaces are configured. |
| A highlighted cell cannot be entered. | Check whether another structure now occupies it. |
Related
- Coordinates, topology, orientation, and layout
- Connect a board view to state
- Resolve board hits
- HexGridCoordinate
- GridActionRunner
- GridBoardView
Next sample
Continue with Explore a tactical hex board.