-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2D Runtime-Baked Navigation Mesh Not Working with Agent #92003
Comments
A NavigationRegion node is a functionality bundle that does a lot of unasked stuff automatically for users. E.g. setting the changed navigation mesh after the bake on both the node and the server region as an update. When you parse and bake navigation mesh with the NavigationServer functions you do exactly only that, and not a single step extra. So in this case you need to both manually update your node or server region (if you update the node it will update the server region). The server sync also happens on the physics process, not normal process so those awaits in script should switch to physics process else those function might "miss" the sync and query an empty map. |
Hey @smix8, thanks for the quick response Any high-level guidance on how I might accomplish this? Also, any objections to having an example of this in the documentation? I think registering baked navmeshes with agents at runtime is a common use case, especially in games with procedural maps. |
Not sure what you are missing, if you updated the navigation mesh you set it again on the region, either on the NavigationRegion node or directly on the NavigationServer region. Examples can be found in the navigation mesh documentation here The multi-agent page has also a long script example how to create everything with the NavigationServer API from scratch here |
Sounds good - I'll see if I can figure it out using those links, thanks! |
@smix8 it looks like I just had to set the navigation_polygon after rebaking it, thanks. In my opinion, this is unintuitive, any chance we could add this to the docs, or a clearer spot in the docs? Maybe the docstring for navigation_polygon could say that it does not register rebakes? From an external perspective, I'd interpret the NavigationPolygon to be a reference, and whenever it changes, the region would register the change. |
Tested versions
v4.2.2.stable.official [15073af]
System information
Godot v4.2.2.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 Laptop GPU (NVIDIA; 31.0.15.3210) - 13th Gen Intel(R) Core(TM) i7-13700HX (24 Threads)
Issue description
I have created a navigation mesh at runtime using the builtin functions. However, my navigation agents - who work with premade navmeshes, but not the runtime-baked ones - appear to not be recognizing these navmeshes, and just path to their global_position and stand in place.
I've tried the following:
It's possible this is my error, something small in the code. However, I think even if there's something missing (and I made a mistake), I'd like to propose we make adjustments to the documentation to provide an example of how to get this to work, since I personally found it unintuitive.
I have attached a reproduction project to assist. Thanks!
Steps to reproduce
Attached in project.
Minimal reproduction project (MRP)
Pathing Test Project.zip
The text was updated successfully, but these errors were encountered: