Blocking nodes for recast/navmesh?

Hello there lads!

I’m in the middle of making my turn-based RPG game, but Unity’s NavMesh is not enough. That’s why I’m here, still undecided if I should get this tool. As I can see in the documentation, there is something exactly what I need - blocking nodes. Sadly, the example is only for a grid graph, which isn’t helpful enough for me. What’s important is that there is no grid in the game, like in Baldur’s Gate 3.

A little about what I need it for:

  • The player’s unit is standing still and might want to check the path to a selected point without moving anything yet, just to check what path the unit will take.
  • After the player orders a move, the unit has to stick to the path without any repathing, stopping only when moving forward isn’t possible anymore.

So what I need:

  • Calculate the path from A to B when the agent is still stationary.
  • Calculate the path from A to B when the agent is ordered to move.
  • Do not auto-repath.
  • No local avoidance.
  • Each agent is also an obstacle (or preferably a modifier volume) which is active only when stationary.
  • While calculating the path for agent X, the path should avoid all other stationary agents’ obstacles (meaning that it has to ignore only its own obstacle).

Will these things be achievable by NavMesh/recast graph along with blocking nodes?

Thank you in advance!


This is doable, I think.

You’ll need to make all agents obstacles. Then, once you select a character, you update the graph so that this agent is no longer an obstacle, calculate whatever paths you need, and make it move. You probably want to use the AIPath movement script, since e.g. the FollowerEntity and RichAI movement scripts will automatically recalculate their paths if the graph is updated. They cannot work without any auto-repathing of some kind. There’s no good way on recast graphs to temporarily ignore an obstacle. But fortunately, you have a turn based game, so you can get away with updating the graph instead.
You’ll probably want to disable the AIPath component while the agents are stationary.