Is it possible to enable Nav Modifiers on dynamically spawned blueprint actors?

Hi, I have a blueprint which has a Box collision component and a Nav Modifier component. The Nav Modifier area class has been set to NavArea_Obstacle. When I add an actor of this blueprint into the level from the editor, it works fine and the AI bots avoid moving through this actor unless the alternatives are too long.

But when this actor is spawned in at runtime using blueprints, the AI completely ignores it. I’ve confirmed it’s placement by turning on the collision visibility and navigation display, and it clearly has no effect on the nav mesh unlike the one that’s placed in the editor manually. Enabling runtime nav mesh generation doesn’t seem to have any effect either. So is there something that I’m missing here? Or does the engine have no support for adding Nav Modifiers using blueprint at runtime?

Hi Stormrage,

I had a similar problem getting the navmesh to rebuild at runtime. Ticking Force Rebuild on Load in the project navigation mesh settings fixed it for me.

1 Like

Hi Alderbit, the nav mesh rebuild part is working fine for me. By placing normal meshes on the level at runtime, the enemy AI changes path accordingly. The issue that I’m facing right now is that the nav modifiers don’t update the nav mesh when spawned in at run time. I had expected that changes in nav mesh area costs would also be taken into account while the nav mesh rebuilds itself.

Finally figured it out. For a collision box to act as a nav modifier, it seems that we have to turn on the ‘Dynamic Obstacle’ parameter under it’s Navigation properties. Now it’s working fine. :smiley:

2 Likes

I have a similar issue. However, my issue seems sensitive to the spawn location of the obstacle with respect to the player controller.

The object is a Blueprint class with a Collision Capsule component attached to it (flagged as a Dynamic Obstacle, AreaClass = NavArea_Obstacle). When spawned at the location of the player controller’s current pawn, I see a patch of Navmesh turn red briefly as it updates. When complete, a red hole is present in the navmesh where the obstacle is positioned. But, when I spawn the same obstacle at an arbitrary location on the navmesh, no hole is left after the navmesh is updated.

My Navmesh settings are set to Dynamic, and to Force Rebuild on Load.

thanks! exactly what i needed so characters dont spawn in meshes