How to update navmesh according to a moving NavMeshBoundsVolume?

Hello World ^^

I working on UE 4.5.1, I’m building a game which generates levels with some square tiles (Static Mesh). This tiles collection is endless and generated according to my player location.
I actually have a NavMeshBoundsVolume set at the world origin in my scene (it is put to movable in its parameters). This NavMeshBoundsVolume also create a raycastnav mesh that I set on ‘rebuild at runtime’.
With a blueprint I update the NavMeshBoundsVolume position to the player location.

It can maybe be easy to understand that by following those illustrations :

And the view of the blueprint that link navmesh/player position :

I need to have an updated navmesh that works all this tiles.
Due to my endless level, I want to avoid expanding the NavMeshBoundsVolume to a large scale value. So my goal in this case is to having a navmesh that don’t exceed a 5X5Y tiles size > 20000X20000Y (Each tile have a size of 4000x4000).

Is it possible to recalculate the navmesh according to the moving player location in real time ?

Many Thanks.

I was about to answer that you should try calling NavigationSystem.OnNavigationBoundsUpdated after moving your NavMeshBoundsVolume, but realized there’s not way to get your hands on NavigationSystem's instance in blueprints. I’ll fix, but it won’t make it to UE4 4.6 version.

So, hack around it for now. Console command RebuildNavigation might help though I’m not sure if it will update navigation bounds.

Cheers,

–mieszko

I’ve tried some experiences around the Console command ‘RebuildNavigation’, but nothing seems to be really updated using only this command.
The only way i’ve found to deal with my problem is to make a Class variable of type ‘NavMeshBoundsVolume’ and create a new instance of it using the ‘SpawnActor’ function.

22759-navclass.png

This method using with ‘RebuildNavigation’ seems to update the NavMeshBoundsVolume’s location… the calculated navmesh is a little bit messy but it’s maybe a starting solution in order to find a better one with this problem.

Thank you and I will follow closely about this point in the next engine’s updates.

Thank you! Even though being very old, this post pointed me in the right direction and saved me from going insane!

1 Like
  1. Click Settings > Project Settings and go to the Navigation Mesh settings.
    Click Project Settings

  2. Under the Runtime section, click the Runtime Generation dropdown and select Dynamic.Click the Runtime Generation dropdown and select Dynamic

  3. Go back to the Level and click Simulate. You should now see the Navigation Mesh update correctly.

!The examples used in this section force the constant runtime generation of the Navigation Mesh which has a high computational cost. These examples do not represent best practices, and are used for demonstration purposes only.

2 Likes

thank you very much. it solved my problem

For the original game in the post calling RegisterNavigationInvoker() might be a better solution rather than moving a navmeshbounds manually. Especially if there are any plans for multiplayer

1 Like