Spawn a navmesh volume with blueprint

I’m trying to create a navmesh volume from blueprint.
So far i tried to spawn the volume with SpawnActor, but i should be missing some points as i can’t figure it out how to make that work (i tried with BSP for testing purpose : it does not work either).

Any ideas how to create a volume with blueprint?

The shape of a Volume is define by BSP brushes, and these cannot be spawned at runtime. So even if you successfully spawn a NavMeshBoundsVolume actor it won’t be fully functional.

What are you trying to do? Is spawning volumes is the only way to achieve what you want?

Cheers,

–mieszko

Hi mieszko, thank you for the answer
What I try to achieve is to have a navmesh added on the map at specified location. The map is too big to cover it all from the editor.

Instead of spawning the volume would it be possible to copy a previously made volume for exemple ? I only succeed so far to move a volume not “duplicate” it.

I have something in the works that will give you functionality you need (should be ready for 4.8). For now I suggest using a workaround, like having a pool of pre-created Volumes you move and scale at runtime.

Okay, i’ll go for that in the meantime. Thanks for the upcomming functionality, and waiting for 4.8.

, would you mind elaborating on how exactly to scale a ANavMeshBoundsVolume instance in C++? I’m a bit confused on how one would do so at runtime with all the brush builder stuff - if that’s even relevant.

The trick I’ve used in one project was to have a unit-sized NavMeshBoundsVolume (1x1x1uu) and scale it at runtime like so:

// hack-change modify frequency - otherwise SetActorLocation will fail.
NavmeshBounds->GetRootComponent()->SetMobility(EComponentMobility::Stationary);

NavmeshBounds->SetActorLocation(MyBounds.GetCenter(), false);
NavmeshBounds->SetActorRelativeScale3D(MyBounds.GetSize());
NavmeshBounds->GetRootComponent()->UpdateBounds();

// redo modify frequency change
NavmeshBounds->GetRootComponent()->SetMobility(EComponentMobility::Static);

where MyBounds is an arbitrary FBox. This works in cooked builds as well. You might need to call UNavigationSystem::OnNavigationBoundsUpdated after such nav bounds scaling.

Hope it helps!

–mieszko

Yo i’m in 4.8 what’s this other method ? I really dont want to have to reference a 1x1uu existing volume.

Navigation Invokers is what I had in mind, and that’s indeed up and running in 4.8. There’s unfortunately no documentation on it, but have a look at a (very rough) video I’ve recorded for it: https://drive.google.com/open?id=0Bwm0SVD0Nb8HdUExVUE1NmkzN2c

Thanks for sharing that video MieszkoZ ! I’m going to test out your system in a game i’m trying to develop. Because my entire level is being generated via blueprints (like the endless runner tutorial), i can put a huge navmesh bounds box and then generate the nav mesh as i go!

Not sure if it’ll work, but without your work, i would’ve had no place to start! TY TY TY!!! :slight_smile:

requested access to said video. I am trying to get nav for my npcs and mob ai to work.

The video has been move to this location: https://drive.google.com/open?id=0Bwm0SVD0Nb8HdUExVUE1NmkzN2c
(updated the original comment as well)

This is exactly what I’ve been looking for, this is literally the only source i found for how to set this up. <3 Am i allowed to post this in the UE4 community knowledge base? If the traffic is too much I can upload to youtube with references back to this post.

feel free to share the link, but do not put it on youtube. I’ll do it myself, but I need to ask right people first.

Good day sir. I’m not sure if you have time but I have had much success with the invokers until trying to use them with persistent levels. As soon as i drop an invoker actor onto the map the editor crashes: https://answers.unrealengine.com/questions/421100/navigation-invokers-crashing-editor-when-used-with.html