Godot version: 3.0
OS/device including version: Ubuntu 16.04.4 LTS (Xenial Xerus)
Issue description:
Using a Navigation node in combination with a Gridmap does not work.
The Navigation Mesh instances in the meshlib are not used.
Steps to reproduce:
Build a meshlib from a scene as follow:
- Spatial
- Plane (mesh instance)
- NavigationMeshInstance
Build a scene as follow:
- Spatial
- Navigation
- Gridmap (using the meshlib)
When using the Navigation.get_simple_path
method, it always returns an empty list of points.
Minimal reproduction project:
GridMap-NavMesh.zip
The above sample project tries to display a list of points returned by Navigation.get_simple_path
in the output. It always returns an empty list however, because of this issue. There is more info in the README.txt
file in the zip file.
Same issue here, can't use gridmap and navmesh to build my scene. More details here, but it's exactly as described by @minitrope 's post
I'm having the same issue
I'm on Ubuntu 18.10
It doesn't work if I make my own plane in blender or just use the primitive mesh from Godot.
If I check the mesh library I can see the tile has a navmesh, but it's not visible in the editor, and you can't calculate a path on it.
It looks like it worked back in 2.1: #5481
So I guess this might be a regression bug.
This one should probably be added to the 3.1 milestone.
This should be added in 3.1.This does not work as explained in the documentation:
Collisions and navigation can also be added to the meshes, just like you would do with the tiles of a tilemap.
Godot 3.1Beta 3
OS: Windows & Linux
NavigationMesh will be seen (when debugging is on). get_simple_path is empty
I can't make it work either, I haven't found any documentation either.
Anyhow...
Build a meshlib from a scene as follow:
- Spatial - Plane (mesh instance) - NavigationMeshInstance
I'm not sure it is the correct order, because, for regular single MeshInstance it works with this order (I've tested with the Navmesh demo, even if it needed some corrections before it could work with bake ):
- Navigation
- NavigationMeshInstance
- MeshInstance
And, trying to figure out which parameter of the NavigationMesh resource I needed to change I found out a couple that are important:
Still, this configuration does not work for GridMap, so I tried the following:
- navigation
- navmeshinstance
- navmeshinstance
- meshinstance \# tile1
- navmeshinstance2
- meshinstance2 \# tile2
- navmeshinstance3
- meshinstance3 \# tile3
Baking the single tiles draws a gizmo (about that, I think another issue should be opened, it seems to be drawn flipped).
Also baking the parent works (I had to place all tiles side by side with no gaps).
Then I created another scene whith the GridMap as follows:
- navigation
- navmeshinstance
- gridmap
Here if I bake again it does not work, I'm quite sure that even if it is working the layout is not correct anyhow: within the GridMap's MeshLibrary, each single Item have a NavMesh property that is not filled whe I create from scene.
Ok, I found a solution.
In meshlib just create the following node structure:
- Spatial
- MeshInstance
- NavigationMeshInstance (created with right click and "Create Navigation Mesh")
Then in the scene place the GridMap below navigation and another NavMeshInstance (not sure if the latter is necessary):
- Navigation
- NavigationMeshInstance
- GridMap (import from scene and select the scene generated as above)
place the tiles as usual.
I created a demo project here:
https://github.com/DigitalKI/GodotGridMapNav
As I go forward testing this feature I realized that there are limitations, or at least, I can't make it work.
It works only with planes, if you use a closed mesh, such as a cube, it doesn't allow navigation between blocks. A workaround I'm using ritght now is to create the navmesh from a plane, and replace the cube's.
Yet, if we have an irregular cube, or a block with obstacles, those cannot be taken into account.
@Anarchid, I think you implemented this feature (https://github.com/godotengine/godot/pull/4302), do you have any suggestion in order to make non plane meshes to work either?
I tried to place each GridMap node under a parent MeshNav node and bake, but it does nothing.
Even a workaround would be ok, as I know that a total rework of the navigation features is planned for 3.2 (https://github.com/godotengine/godot/pull/15110#issuecomment-408683381).
Also @aqnuep have worked on GridMap editor, so your help too is welcome.
if you use a closed mesh, such as a cube, it doesn't allow navigation between blocks. A workaround I'm using ritght now is to create the navmesh from a plane, and replace the cube's.
AFAIK this should work. If it doesn't, either godot's navmeshes do weird things, or - more likely - your original cube navmeshes don't link for some reason. Conceptually a navmesh's topology is just a bunch of connected triangles, which is what allows you to implement things like bridges etc.
I tried to place each GridMap node under a parent MeshNav node and bake, but it does nothing.
I never got to making it support baking or even completely understanding how that works. The workaround here is to not use baking, unfortunately.
Is it possible that this whole issue's underlying problem is due to baking?
Tried the technique referenced by @Toshiwoz. Nothing.
All vertices are lined up, all tiles are connected nicely, tiles are planes, nav meshes have been generated for these planes. Am I missing something? I have no idea what the demo does correctly, because I cannot replicate that in my own project.
@TheMikirog sorry to hear that, anyhow my guess is that the terrain is not made of planes (I'm referring to MeshInstance's PlaneMesh), and that's the only geometry that works, at least for me, I mentioned that:
As I go forward testing this feature I realized that there are limitations, or at least, I can't make it work.
It works only with planes
The only way I heard, to go around that is to create your own navigation mesh in your favorite 3D design tool (Blender?), and create a mesh that have a name that ends with -navmesh
, see this answer in Q&A:
https://godotengine.org/qa/16174/how-to-create-a-navmesh-resource-from-an-imported-mesh
To my knowledge, the corners (vertices) of each navigation mesh have to match with any other tile's navesh, or else it won't work.
Please note, I'm not saying that Godot's navigation with GridMaps is flawless or does not need any fixes, I'm just trying to make this work on this version with the current status.
Yet, in my case, I'm moving to Astar, more code, but more freedom.
A workaround that I tried was also to create a PlaneMesh of the same size of the tile I was going to use as terrain, then create navmesh from that and then place it below each tile that I wanted to be walkable.
Still, I have lots of questions I have no answer for:
To my knowledge, the corners (vertices) of each navigation mesh have to match with any other tile's navesh, or else it won't work.
Exactly. Even a tiny difference like 0.001 makes it not work.
anyhow my guess is that the terrain is not made of planes (I'm referring to MeshInstance's PlaneMesh), and that's the only geometry that works
Well, tried that and still nothing.
I just gave up on GridMaps for navigation and just remade all the maps as singular models.
At least these meshes connect together if I make multiple "areas" that I can place next to each other. I found it easier and gives me potential to make more uniquely looking rooms.
Limitation breeds creativity.
Okay so I've been playing around with this and here are my findings:
Navmesh on a Godot generated plane works. Navmesh on any imported plane does not work and you cannot bake it. (I more carefully recreated the plane in Blender and it did work)
I instead made the navmesh in Blender using the -navmesh
method mentioned above. Please note do NOT mark your edges as sharp on your navmesh as it will ruin it. I then exported these as .gltf and had to manually text edit all the floating point precision errors e.g. 0.50000001 to the correct values e.g. 0.5. I could then import these into Godot and use them.
If you are using complex sized gridmaps you must make sure vertices line up with their neighbours:
As many have mentioned before your vertices on the navmesh must join exactly on their borders
This issue explains the limitations in great details but was difficult to find. I suggest the documentation be updated to list them if they are going to be here a while, as the workaround is usable (if you can find it).
Relevant pages:
I just found this, (for me I had to put the gridmap as a direct child of the navigation mesh, in the video it didn't seem to matter). Go into your gridmap, go into the meshlibrary and for each item you want to add in a navmesh.
https://www.youtube.com/watch?v=RuEqL2gfQYs
Edit: Sorry I may be missing the entire point to the post.. But if anyone is in the same boat as me. Here ya go...
Yeah, that video, I made it time ago, see my comment above:
https://github.com/godotengine/godot/issues/17118#issuecomment-458667564
I don't remember everything about this issue, but I think there was an improvement, made months ago, I'm not sure if this is still an issue.
Yeah, that video, I made it time ago, see my comment above:
#17118 (comment)I don't remember everything about this issue, but I think there was an improvement, made months ago, I'm not sure if this is still an issue.
thanks... it helped if i learned how to read lol..
Most helpful comment
Ok, I found a solution.
In meshlib just create the following node structure:
Then in the scene place the GridMap below navigation and another NavMeshInstance (not sure if the latter is necessary):
place the tiles as usual.
I created a demo project here:
https://github.com/DigitalKI/GodotGridMapNav