0 votes

Hi, I'm trying to figure out Godot's 3D navigation / navmesh system, but I'm having trouble. There's very little documentation and I've only found one rough tutorial on YouTube. What I want to know most of all is, how is it meant to be used?

From what I've seen in that YouTube tutorial here: https://www.youtube.com/watch?v=_urHlep2P84&t=328s and read in the documentation here: https://docs.godotengine.org/en/3.1/classes/class_navigation.html the Navigation node has NavigationMesh children which have MeshInstance children, and then when you select the NavigationMesh you get a Bake Navmesh button that bakes a Navmesh based on the geometry of the NavigationMesh childen.

Does this mean the Navigation node should be the root node of any scene with world geometry, and the world geometry all a child of a NavigationMesh?

But here's the tricky bit, you can have more than one NavigationMesh child for a Navigation node, with different Navmeshes calculated for different mobiles to use. IE A player, a small enemy, and a big enemy. These navmeshes are created using the same geometry, then saved as a resource and plugged into the NavigationMesh nodes. So it's possible to generate navmeshes and put them into the Navigation system without having it sit at the root of the tree.

So what I'm thinking is, what if you're 'supposed' to have the Navigation node not as the root of the tree but as another same-level node, fed pregenerated Navmeshes? The trouble with this is, if the Navigation node and its NavigationMesh child aren't containing the level geometry, you'd have to make another Navigation node and NavigationMesh node holding the level geometry just to bake the navmeshes each time you made a change, right? This seems inconvenient. The other alternative would be to double my level geometry just for baking navmeshes but that seems like a bad idea too.

So my problem is, I'm not sure how the Navigation node and system are meant to be used in Godot's already existing structural system. There's plenty of documentation on how Godot is meant to work, though of course you can change it... But there's no info on how to use the Navigation node and system.

So how is the Navigation node and system meant to be used?

in Engine by (12 points)

1 Answer

0 votes

Assuming the 3D version of Navigation follows the same logic as Navigation2D, you are right. A Navigation node gathers all navigation meshes it finds down its hierarchy and uses them to form the global navmesh for agents to generate paths from.

The idea of multiple layers of navmeshes is a good point. I haven't had to handle this situation yet, but the tree structure makes it impossible to accomplish this goal without changing the API and introducing some kind of "layer" parameter on all functions. Maybe that could be requested to change in the future (if nobody asked already?).

In the meantime you could separate multiple Navigation nodes on their own as child of the level, and move navigation meshes for each specific layers under one of them. That could be done through a bit of scripting, but completely destroys the usefulness of the scene system...

So I'm curious myself how this may be handled in the future.

by (27,595 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.