Update Nav Mesh after Actor Spawn In-Game

I made a simple scene, added a BSP spiral stair, and a Nav Mesh Volume.
I see the green nav mesh on the flat ground, and going up the stair.

Then I took another BSP Spiral stair, exported it as a static mesh, made a blueprint from it, and add it to the scene.
The Nav Mesh updates just fine. (in the editor)

Then took my player blueprint and made it so F7 spawns the sprial stair 10 meters away from the player along the camera forward vector.

So I can spawn in spiral stair static meshes and walk up and down them. I can make the stair spawn above the ground, party submerged in the ground etc.

Problem: The Green Nav Mesh does not update after the stair is spawned in in-game.

Question: Is there some call like “RecalculateNavMesh” that would cause the nav mesh to update in-game?

I need this because we will be adding buildings on-the-fly after the game starts and they need to participate in the nav mesh interaction with NPCs.

1 Like

Hi, did you ever find a solution to this? I have the same issue where navigation changes triggered from in game events (rather than editor manipulation) don’t cause nav rebuilds

Hi there! Whenever you create a NavmeshBoundsVolume, a RecastNavmesh actor will spawn in your scene as well. In this actor, you can change all settings for navmesh. What you’re looking for is at the bottom of the list, where you can change the behavior of navmesh from static to dynamic. This will make the navmesh reload affected segments in real time.

If you have problems with AI pathing beyond that, use the NavLinkProxy actor to make sure the AI knows how to use special segments of the navmesh (such as doors, precipices, etc.)

2 Likes

Hi,

Worked for me :

2 Likes