Obstacle detection doesn't work well with square rooms and hex grid

If I’m not mistaking, the way we look for obstacles is by raycasting from the center of the cells.
But our cells are not aligned in straight lines anymore since we changed them for a hex grid, it means some walls will not be detected as obstacles if they are too thin…

In the image included, you can see walls (red squares), cells detected as obstacles (grey hexagons), and as you can see, the vertical wall is not detected as on obstacle on odd rows. So units can walk trought them (blue lines)

I’m not sure there is a way to fix that, except from making very large walls, but I would love to her your suggestions about this issue!


Yeah that’s a problem with hex grids, the only two options are really thick walls or non-rectangular rooms.
Alternatively you could make the visual a regular thickness and only make the collider itself very thick.
If you want perfectly square rooms then the best option would really be to just use a rect grid.


This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms