Hi, I would like to know if there is any way to rebuild the nav mesh manually using some blueprint command. I know that I can enable runtime rebuild of nav mesh. But I just want the rebuild to happen only when I do something specific like say add some new mesh to the level.
I went ahead with runtime dynamic rebuild for my project. It works that way, but if I could turn it on/off on the move, it would help optimize the game. I have two modes in my game, the first one requires nav mesh rebuild as I’m placing objects on the level. In the second mode, I would rather turn it off, as it’s completely combat focused and hence do not require the nav mesh to rebuild.
AFAIK, there is no need for such functionality. With
Project Settings > Navigation > Runtime Generation set to
Dynamic, anything within the navmesh volume automatically updates any blocking volumes which occur at runtime. So if you were to spawn a mesh which blocks part of the navmesh volume, it would update accordingly on the next tick. As for updating the bounds of the navmesh volume itself, I believe I’ve read somewhere how this is possible, but I can’t remember if it was available via blueprints or only in C++. But your best bet is to simply set it to the maximum size that it will be in your project, and create temporary blocking volumes where you wish to cut off navigation.
If you could provide a use case where the above does not apply for your particular project, then perhaps someone could better assist you. Otherwise, just use
Dynamic runtime generation.
Setting it to Dynamic causes 20-40 ms to be added to the game time for our project. Setting it to Dynamic Modifiers Only is much better and only adds 0-2 milliseconds. However, we have dynamic objects which change location, and we aren’t sure how to get those actors to receive updated nav data-right now the object moves and the nav mesh stays in the same place.
Still no solution for this? How would I force a navmesh rebuild in Blueprint? - Blueprint - Unreal Engine Forums has some answer which didn’t work for me, namely “Execute Console Command function with parameter RebuildNavigation”.
I want to stream in a level and then rebuild the navigation - would be best to only for said area. Maybe I will make a gigantic navmesh and add only a dynamic nav modifier to the streamed in level…
But even so I don’t like the “just make it update all the time” approach. Seems really obvious to me to have a command to rebuild things such as this when needed instead of choosing “never” or “all the time”.
Would make optimalization much easier.
So far what I’ve tried:
Dynamic Modifiers Only mode
Persistent level has a huge navarea bounds volume, encompassing even the soon to be loaded level as well.
Streamed in level has navarea modifiers set to default and a small area set up so it will fall into the original area of the persistent level when loaded, set to null…
When streaming in the new modifier volumes the null one blocks off the area from the original persistent level properly BUT the ones set to default do not add the new area. If set to full runtime update then yes, the new area, as covered, will be added but that’s irrelevant here.
The important thing is that while the null modifier worked the default one did not - so this approach doesn’t work (so far) as the area that wasn’t built up won’t be even if it’s covered and has a dynamic modifier asking for it to be used as a default navarea.
(Added navmes to streamed level as well, no effect).
Maybe if I used invokers… but… well… a “rebuild navigation” command would solve it so easily.