Generating Navmeshes

I have seen no tutorial or documentation describing how to generate navmeshes using cesium. Is this possible at this time?

Hi @JohnGarcia,

In the near future I will be experimenting with AI characters and navmeshes within Cesium for Unreal. I believe it should be possible, and I would suggest trying Navigation Invokers to dynamically generate a nav-mesh at runtime.

Because Cesium for Unreal will unload tiles outside your view by default, you may want to disable “Enable Frustum Culling” if the AI character begins falling through the world when you look away.

Let me know how it goes!

1 Like

Thanks you!!! I’ll be exploring cesium a bit more in the next few days and this should make for a great start.

I went ahead and set up a project using navigation invokers. The problem it seems is that I can’t generate a navmesh for the cesium terrain, does this have something to do with the how cesium is streaming in terrain?

I’m using sublevels so I did place the navmesh bounds in the persistent level, though I also attempted to place one in the sublevel itself when that failed.

Thanks for the update @JohnGarcia. I tried this on my end and ran into the same issue. I believe it has something to do with the “Can Ever Affect Navigation” setting, which is not exposed in the Cesium3DTileset actor class. Nav meshes were successfully generated with the cube static mesh, which does expose this parameter, and is checked by default.

I can take a look into enabling this setting on the Cesium3DTileset actor class (hopefully tomorrow).

Thank you, if you can update me when you learn more that would be appreciated.

Hi @JohnGarcia - I took a bit of time to look into this and created an issue / branch on Github for it: Generate navigation mesh on Cesium3DTileset · Issue #327 · CesiumGS/cesium-unreal · GitHub

Unfortunately I was unable to get it working by simply adding a UNavLinkComponent to the Cesium3DTileset actor. If you have any further findings to share, your comments on the issue would be much appreciated. There are some other tasks I must work on for now, but I will let you know if I revisit this issue in the future.

I was trying to do this as well, but then I realized that if you want this to work, you’re going to need a “globe aware” nav mesh as well, otherwise it won’t work on the whole earth right? It would work to a certain point, but since the earth is round, I figured you might run into problems as the surface curves. I didn’t need this for AI, but for teleporting in VR using Unreals out of the box VR stuff. I ended up removing the navmesh entirely and just checking collision with the tiles, and it works really well.

2 Likes

That’s great hear. Do you mind giving me a brief overview of your method? I guess I might find worth out of re-exploring cesium this weekend.

Hi @nbaja,

Although there’s not a convenient way to place the navmeshes yet directly on terrain, navmeshes in general should most likely work within georeferenced sublevels. While the navmesh itself may not be globe-aware, if it is wrapped inside a sublevel then it will work locally (i.e., when inside the sublevel). This is true in general for static objects that cannot be made globe-aware with the CesiumGeoreferenceComponent. Wrapping something inside a sublevel may not work for all cases, but typically it’s the most useful way of placing static objects that will never have to move relative to the earth.

Hi, nbaja!

I’m also trying to get Cesium working with VR and teleporting and was researching navmesh for this purpose. Can you explain (or link me to a right direction) how to “remove the navmesh entirely and just check collision with the tiles”

Sure.

I used the default VR project as a base. The way you move in that project is that you “throw” a sphere and then teleport to that location. There is a function there called Trace Teleport Destination which traces where the sphere hits, among other things. By default, that function for that checks for a collision, and then it checks if the navmesh is there also.

Here’s the default function:

All I did was remove the check for the nav mesh:

There’s a bunch of other stuff you have to do to make the graphics correct in relation to the earth. I suggest following @Nithin_Pranesh 's suggestion here: Orientation of the globe aware pawn - #6 by Nithin_Pranesh. Basically whenever you throw the sphere, you recenter the world there, that introduces another set of issues, but they’re all solvable.

@JohnGarcia sorry I forgot to respond, hopefully this will point you in the right direction.

2 Likes

Thank you! It works like a dream!

Actually, can someone help me with something? I had this working in a previous version of the plugin, but I updated today, and now I can’t get my sphere to collide with the world anymore, so in the context of this thread, I can’t teleport anymore. The last time I checked this was when I was using the 1.1.0 version of the plugin, and it was still working. My collisions are still working in a general sense, because if I put a cube in the level, I can collide with it. Previously though, it was working on the geometry of the earth itself but now it’s not. In the change log, I see a fixed bug about the collision not updating. Is there something special you have to do now to get it to update, or to turn it on? Or is there a test to see if the collisions are/are not loading? I tried bringing my stuff into the updated Cesium samples project to see if there was something there that might have changed, but I’m getting the same results there. I’m hoping it’s this, which looks like it’s already been fixed in the next patch.

EDIT: Yeah it is the issue sited above. The plugin seems to be manually overriding the collision preset of the earth to world dynamic, ignoring whatever collision preset you selected. If I change my collision to search for world dynamic, it hits the world again.

Yes it sounds like that will likely be fixed by the issue you linked. You can easily try it out. If you click the green tick mark in the main branch (or any other branch) on github, you’ll see a link for “plugin-package-combined”. Click the Details link next to it to download the ZIP file, and extract it into your engine plugins directory. You may want to uninstall the plugin from the Unreal Engine Marketplace first.

Oh awesome. Thanks for that.