It doesnt seem to be possible. I see the
Bake Navmesh button in the editor calls this in the editor code:
Which by the name means it’s not available in exported game, and probably not even exposed to editor scripting. It uses the
Recast library internally.
If you need that for your game, you have two options:
Either you generate your navmesh from geometry that you generated yourself already, and use
NavigationMesh functions to construct it: NavigationMesh — Godot Engine (3.1) documentation in English
(don’t just take your meshes directly though, it’s a navmesh so it needs to be offset).
If you need the editor baker, you could do a feature request on Github, or expose it yourself by modifying the engine (it’s open source after all).
I created a simple unit that moves to mouse click on a navmesh. It works properly when the navmesh is baked in editor, but when I use the method
NavigationMesh.create_from_mesh(Mesh mesh) the path I get from
Navigation.get_simple_path(Vector3 start, Vector3 end) is a 0 sized array, so it doesn’t seem to work. Any idea why? Also, is there a way to see the navmesh in the running game for debugging purposes?
KijeviGombooc | 2019-07-19 16:38
I just checked the other methods of NavigationMesh (none of them have description, I might add them if im sure about them and if i learn how to add descriptions ). So by checking them I checked and my mesh was added as navmesh, but I don’t knwo why it’s not working.
KijeviGombooc | 2019-07-19 16:58
Ok, got it working, just had to tick “enabled” to false then back to true, so far doing it in editor after starting. But there is a problem, the pathfinding seems to only work this way with only one triangle of the mesh(which is a not subdivided plane right now for me). When I click to other tri, the unit is going to some place in first tri.
KijeviGombooc | 2019-07-19 17:15
Ok the stopping of movement bug was because the script on the Unit was too simple yet, had to make it better, won’t go into details, it was simple fix
So, the navigation was created in runtime! Now I just gotta figure out a way to offset the mesh, do you have any idea?
Also I’m gonna have to see how to create navmesh from more than one mesh. Do you know if there is a way to maybe combine meshes so I can still use a single mesh for this?
KijeviGombooc | 2019-07-19 17:34