I’m creating a game with an infinite world-building system, similar to Minecraft. I also have NPCs that require AI movement, which relies on a NavMeshVolume. The problem is that I can’t have an infinite NavMeshVolume, because it would crash the game due to too many calculations.
I considered using a NavMesh Invoker, but that doesn’t really make sense in my setup since you still need a NavMeshVolume to generate navigation. Another idea I had was to create a NavMeshVolume that follows the player.
I’m not a beginner, and I know my Blueprint setup is correct because similar logic works for other things. However, when I try to make the NavMeshVolume follow the player, it doesn’t work, even after setting it to Movable.
I haven’t been able to find an answer anywhere. Can anyone help me figure out how to make a NavMeshVolume dynamically follow the player in an infinite world?
Navigation Invokers are THE way to go about this. I suggest this tutorial for setting that up on your actors!
Hope that gets you where you need to go, feel free to ask any questions about any parts you don’t understand, I’ve done this quite a few times at this point.
Hey, first up I appreciate the answer but the problem is the invokers only calculate the area where the nav mesh volume is in, meaning for a infinite world i would need it to be infinite, your first thought would be ok just scale it really high up, but even with invokers it still crashes, that’s why I said in the question invoker doesn’t work, I still believe there has to be a way to make the navmeshvolume follow the Player which would fix the problem.
If you move the NavMeshVolume (NMV) it has to immediately update itself as to what’s accessible. Just as it does when you move it in the editor. Essentially an On Tick re-build navigation.
You don’t think that’s going to be a performance hitch. Potentially a crash causer?
No, Found a Simple Solution for that and also Fixed the whole problem, what i was missing was a “On Navigation Bounds Updated“ This made it work and for your problem you said, I just made it into loop with a delay (0.2 is still too low, so gonna change it)
You don’t have to keep adjusting the size of one nav mesh bounds volume… Minecraft was your example, it generates the world in 16x16 1-meter block chunks (and whatever Z is depending on version), correct? When you’re generating those chunks, you create a new NavMeshBoundsVolume in the center and make it 165x165(+5 is to make sure it overlaps). Every chunk gets its own NavMeshBoundsVolume- which will do nothing and contribute very little overhead as long as there are no actors within it, but ensure all of your generated level is walkable, and far more performant!
On another note- make sure your actors are getting despawned when out of a certain range of the player! Getting tons and tons of moving actors updating a navmesh would be ROUGH.
Thank you that’s a good Idea, but I think the way I’m using right now is maybe even better, because I’m not attaching the volume to an enemy but to the player, so dont worried about enemies walking from a far distance, and the other problem would be the lag from the constant changing, but with a small scale and 2.5 seconds to update its barely noticeable. Also I already had you Idea, but its total pain to spawn a NavMeshVolume from nothing (No cant do that with Spawnactor) the way I did it, I placed one in the game and used that one! If your though seeing a problem with this tell me!
No, that also works!
As long as you aren’t using any method to see far into the distance that should work okay! (this is why AAA Games are so HILLY and JUNGLEY, so you don’t realize the actors are despawned. Not doing this gets you intense player spite- just look at the pop-in complaints of recent Pokemon titles!) You may need to fiddle with it here and there once you get to the optimization stage.