Filter Cells - Bridge Diagonals
Ensure diagonally touching cells are properly connected in 4-way terms by adding minimal orthogonal bridge cells.
What it does
When two cells touch only at a corner, this action inserts a bridge cell so the connection becomes 4-way (orthogonal). This removes corner-only gaps and prevents “islands” that are diagonally attached.
Inputs
| Field | Description |
|---|---|
| Cells | Input open cells as Vector2Int positions. |
Outputs
| Field | Description |
|---|---|
| Bridged Cells | Cells after adding bridges. Supports input == output safely. |
| Added Bridge Cells (optional) | Only the cells that were added as bridges. |
How it works
Scans each cell’s diagonals; if a diagonal neighbor exists but both orthogonals are missing, it adds one orthogonal cell (deterministically) to bridge the gap.
Tips
- Run this before connectivity checks if your pipeline mixes 8-way generation with 4-way navigation.
- Useful in tilemaps that expect strict 4-way traversal for pathfinding or corridor logic.