A* Pathfinding Project

Make unreachable path traversible


If I were to enclose a block with dynamic obstacles, how can I still have a path on the inner part of the block?

Here is a picture to describe better. I want the units to still be able to path inside.

Thanks! Great product!


Is this even possible?



Are you using a NavmeshCut here?
If so, you could use a custom mesh as the cut. Alternatively you could construct the border out of 4 smaller navmesh cuts.


Yes, but These walls are dynamic and can be created and destroyed, quite a bit. They also could be any shape the user builds. Is that still viable? Is there any way to have it just always be walkable


If they can be any shape I assume you have some way of defining the border of it? Then you can just put smaller NavmeshCuts around the border instead of covering the whole thing?


Thanks for replying before you take off. Maybe you are correct, but I just wanted to clarify more.

I mean the player can build the wall in any shape. walls are just 1x1 squares that they can build around their units. Anytime I enclose the units within walls, the path becomes unwalkable, and the units inside pop out of the enclosed walls. I would want the units to still pathfinding inside these walls.

Each wall is a dynamic obstacle/unit with a selection ring. In the GIF I make a square, but it could be any shape the players decides. The walls also could be connected to a cliff, lets say. and the cliff is part of the closed border of the wall.


That’s strange… Could you post a screenshot of how your navmesh looks after you have built it?

In the RTS example I can manage to position some navmesh cuts so that the units inside cannot move outside of it.


What do you mean? I can, but can you explain what you need?

Once I enclose the units, the path becomes grey like in the picture of the first post. Before that everything is pathable.


Also. You are saying dynamic obstacle all the time. Are you using a navmesh cut or something else? Is that hexagon button for re-scanning the graph?

If you are re-scanning the graph then possibly that region is smaller than the ‘Min Region Size’ in the recast graph settings and it is removed because of that.


It is a navmesh cut. It is the barracks but reshaped to be a square.

The button just toggles building or moving units.

I am not re scanning. If I remove one square, the path fills in the area, so I thought it was updating fine.


Okay… I’m not sure what could be going wrong here.
Are you getting any error messages?

You might want to expand your squares a tiny bit so that they overlap slightly. I think having them just touch each other should work well, but you never know with floating point errors.