How to make characters change NavMesh

I want AI-characters to change the NavMesh so that enemies can run around an obstacle and attack the player from behind if the direct path to the player is blocked by other characters.
I was able to achieve something like that last summer with a previous version of UE (4.10?), but I don’t get it going anymore in 4.12.
So in the picture above i want Enemy3 go the way in the ‘wannebe situation’.
Any solution is welcome, but C++ is preferred.
Thank you very much!

97258-navmeshpain.jpg

Found it!

  • Just check ‘SetCanAffectNavigationGeneration’ on the character’s properties to true.
  • Find: Project Settings->Navigation Mesh->Runtime->Runtime Generation and set it to dynamic.
  • Maybe there are more checkboxes somewhere else I forgot…

Some quick experiences:

  • only enable ‘SetCanAffectNavigationGeneration’ on character if character is standing. if moving, disable it. (would be extremely helpful if ‘MoveToLocation’ would have ‘OnFinished’ out pin in BP)
  • only tested on small environment. So might cause performance-problems on terrains.
1 Like

How do you change ‘SetCanAffectNavigationGeneration’ when it’s moving?
I have added blueprint nodes for “EventTick->CharacterMovement → Is Moving on Ground ->” but can’t find a way to set it at runtime

Switched to Unity in the meantime.
But having a look at the code, I set it in Tick() in C++. I check for velocity every Tick and if vel.Size() is near zero, I call SetCanAffectNavigationGeneration(true).

1 Like

Thanks, I actually discovered shortly after that I was doing something a bit stupid and should just check that |velocity| > 0 like you said. For future reference this is how I did it in blueprints… !