Realtime navmesh and AI move does not work together?


I have been struggling all day with this one thing going wrong all the time, I am making some sort of RTS where the units auto walk to the closest enemy unit/building.
everything works fine, but the issue is that I need to have rebuild navmesh on, so that my units don’t walk into my buildings that I have build during the game.
But ones I check the option to rebuild navmesh in project settings, my navmesh just doesn’t work at all anymore, or shows very very odd behavior, as in units twitching to different kinds of directions or even not moving at all.

while without the real time navmesh calculations my units walk into a straigth line to their goal, and if I place buildings along their paths and rebuild the navmesh, then press play they walk around it and find their way perfectly!

so it feels like updating the nav mesh real time bugs out the moveAI blueprint that is provided, so is there a work around or am I doing something wrong?
I included the print screen of my move function, the values in my Blackboard are also constantly the same target when I debug, so it isn’t that he is switching targets continuously, it is really the navigation that is messed up…!
move to function

if I enable the real time nav mesh, but use the directly towards function in the behavior tree it works as well, so it is really some kind of issue with the navigation mesh…

Next time you’re reporting a navmesh bug please post some images. Also, you probably would spot yourself what I’m going to say :slight_smile:

It sounds like you’ve configured your AI units/characters to cut holes in the navmesh, either by making them navmesh dynamic obstacles (Pawn.CanAffectNavigationGeneration flag) or just using a custom setup with StaticMeshComponent. If that’s the case then what’s happening when AI tries to move is:

  1. It successfully finds a path
  2. It starts following the path
  3. The navmesh AI is walking on gets invalidated due to “navmesh colideable object” changing location, and so does the navigation path AI is following (and so do all other paths going through given navmesh polygon)

First of all try using one of our AI avoidance instead of cutting holes in navmesh with your AI. If you still need hole-cutting then consider enabling it only when AI is stationary and disabling when AI starts moving.

Hope it helps,


Alright that fixed my issue, well it was hard to take a screen shot of it, because when you would just make a shot they would seem to be moving but they were just twitching, thus I knew there was a recalculation of the nav mesh continuously, but I had no idea how it was triggered. But now that you said that you can turn it off in the pawn mesh it works fine!

thanks a bunch :smiley:

What is “AI avoidance”?