How to set up a GridMap with Navigation?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cgardner
:warning: Old Version Published before Godot 3 was released.

Hi!

I would like to make a gridmap with navigation for 3d point-and-click movement, Diablo style. I created navmeshes for each item in the MeshLibrary using the Mesh->Create Navigation Mesh tool, but I am struggling to find docs on how to set up the Navigation Nodes.

Should each mesh in the MeshLibrary have it’s own Navigation node, or should the whole MeshLibrary have just one Navigation node, and all the generated navmeshes go into it? I understand that gridmap navmeshes are joined together automatically, but I can’t find anything written anywhere on the Internet about how to actually use a GridMap with Navigation meshes.

Thank you for your help!

:bust_in_silhouette: Reply From: davidoc

You can use both, it depends what you need. for what you explain you can add a NavigationMesh node for each GridMap element and the GridMap node should be a child of Navigation. The other approach could be used when you have one or few big meshes for Navigation and want to put elements around it.
In my experience GridMap for 3D needs to be improved to be really usable. After problems with scale, positioning and rotation of NavigationMeshes, I ditched it and created my own functionality preloading a Scene and instancing the required elements (I create my maps dynamically).

Thanks for the reply!

I got the navigation to work for a single gridmap piece using what you said (gridmap is now a child of a navigation node), but the pathing doesn’t go across multiple gridmap elements. I used the built-in navmesh generation, so the navmeshes are aligned adjacent to each other. I tried overlapping them a little but that didn’t work either. I thought gridmap elements were supposed to merge their navmeshes automatically but that doesn’t seem to be the case.

I’m on 2.1.3. Is navigation with gridmaps just bugged until a future release? I don’t have issues with placement or rotation myself, but everything I’m using is squares since this (supposed to be) quick layout for dev/test levels.

cgardner | 2017-10-03 23:19

Addendum: I got it to work! After changing around the MeshLibrary, I was only clearing and re-loading it into the GridMap. Turns out the GridMap was “remembering” something about earlier versions of this particular MeshLibrary, and once I deleted and remade the GridMap node completely the transitions work as expected.

Also, I had to go back to Blender and make the navmeshes into planes manually, instead of the generated cubes I had before.

cgardner | 2017-10-04 00:41

Glad you have it working. I try to use the simplest possible shape, just planes and slides. If now you start adding collision shapes you’ll find the only viable solution is to use a cube shape at the default position and adjust you meshes position.

davidoc | 2017-10-04 03:24

Hi, how did u create navigation for dynamically created elements? If by that u mean created the map from script.

KijeviGombooc | 2019-07-19 11:16