Mastering NavigationMesh

Hello,

Help me with NavMesh please - how it work, under which conditions? I have a simple scene with 3 actors:

  1. The first actor - blueprint, derived from Actor.
  2. The second - blueprint derived from Pawn
  3. The third one - derived from Character

Every blueprint have a UBoxComponent as well as UStaticMeshComponent with some mesh. Both have collision preset “BlockAll”.

When I turn on NavMesh visualization I see that only first actor modifies mesh.

Next, I’m changing location of every actor every tick. And I see that NavMesh is not updates (I turn on realtime NavMesh calculation in options). But if I move first actor with move gismo - NavMesh updates.

So, questions:

  1. Is it possible to affect NavMesh for actors beyond Actor class?
  2. How to update NavMesh dynamically in realtime?

1.Is it possible to affect NavMesh for actors beyond Actor class?

By design Pawns do not affect navmesh (and Character is a kind of a Pawn). However it is possible, in C++ code to make even these classes affect navmesh. Fist off you need to override APawn.UpdateNavigationRelevancy to not set navigation relevancy to false. After that having a blocking UStaticMeshComponent should be enough.

However, I’m not sure you want to do that. Our navmesh generation is pretty fast, but having navmesh being constantly rebuild due to moving agents affecting it is not a good idea. If you want pawns avoid each other you need to use some kind of crowd simulation or avoidance solution. We have these in the engine :smiley: Let me know if you need more information on how to set these up.

2.How to update NavMesh dynamically in realtime?

Moving navmesh-relevant actors in-game while runtime navmesh generation is enabled should result in local navmesh rebuilds. How have you implemented your actor’s location changing? Remember you need both NavigationSystem.bBuildNavigationAtRuntime and NavigationData.bRebuildAtRuntime for it to work.

Cheers,

Thank you, . Your answers always help a lot. I understand now that rebuild navigation for pawns not a good idea. And yes, hint about crowd behavior is very apretiated. Regardind issues with navmesh and actor I found somerhing - to make it work actor should have a component (static mesh or shape) with simulate physics turned on, collision enabled and in collision presets pawn or vehicle should be set to block.

On second thought please ask a new question about current crowd simulation support in UE4 so that we don’t answer two questions in one thread. Thanks in advance!

dynamic navmesh update works nice by overriding UpdateNavigationRelevancy, i was able to use it with good results on my pc. Reducing the update frequency to 10 to reduce overhead (Project settings/Nav. System / Dirty areas update freq) gives jagged movement, so I don’t think reducing the frequency solves anything.
On the other hand, RVO avoidance still seems unstable/weird. Maybe it’s just a misconfiguration, but even when I select only 1 character to move to a desired location, sometimes it never really gets there, it just rotates around the destination point like it was slipping on a rotating ice around the target. I found it more acceptable if the characters just collide sometimes without RVO than using RVO. I still haven’t tried crowd simulation though