-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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
Enabling/disabling NavigationLink3D / navigation_layer
not updating paths
#83707
Comments
The bug was that the link connections were added regardless of enabled state when the navigation map was rebuild. Navigation map geometry changes trigger a signal for automatic path updates on all NavigationAgents on that map. That said changing just detail properties (layers, costs) of navigation bases like regions or links do currently not trigger automatic path updates. Those kind of changes do not require a rebuild of the navigation map geometry, hence no signal, and are considered in the next path query. That those property changes do not trigger a navigation map rebuild is currently kept on purpose because the navigation map can only do full rebuilds, not incremental. Full rebuilds are very costly so not triggering those with a e.g. a layer change is currently the only escape for runtime performance while still dynamically changing path searches. Might be changed when the navigation map sync gets changed to not be such a runtime performance burden or having different dirty stages for the signals. Unrelated but in the test project there are also a few setup and script problems that made it hard to test e.g. that movement does not work with a half-path due the blocked function when set target is not reachable, the patrol point target switch does not work with a blocked path due to the distance check or that apply_state() gets called twice, once by the setter and once by the button signal. |
@smix8 thank you. You say that "those property changes do not trigger a navigation map rebuild". Can you explain why enabling a navigation layer on a link causes agents to recalculate paths, but disabling the layer won't? That's the other issue I've raised here. Video here. The point of the video is to show that enabling a navigation layer triggers a path recalculation, while disabling does not.
Good catch, that wasn't intentional. |
Note that the above issue with I've pulled master and updated the repo to attempt some fixes now that you've fixed enabled toggling. Two things I've noticed:
|
Further observation: if a NavigationLink3D is disabled in-editor, it cannot be enabled at runtime. Video here. @akien-mga or @smix8 can we please reopen this |
That is
If a NavigationAgent finishes its current path it will no longer auto-update the path on a map change as the path is already finished and the agent state reset.
Changing Changing a region's or link's Changing the
I looked at it again and the NavigationLink nodes are missing multiple property updates for the server object in the constructor. So if the node was disabled this disabled was not send to the server object without toggling it again. Made a pr to fix that but this issue would only block the first property update or when the value has not changed, not all runtime updates. Test project issues That said even with the fix pr your specific test project will still not be working due to the custom movement and update logic. I recommend falling back to a more simple agent test script, e.g. the one from the official documentation. For the ping-pong movement between the two targets set them on the navigation_finished signal. Right now the is_target_reachable() check alone is blocking the majority of the logic when the target position is not reachable by the agent. The the distance checks on the update_target() will also cause that no new target position is set when the agent is in the middle. So when the path is finished and the agent ends up in the middle due to the blocked path/link it will just start to do nothing. |
navigation_layer
not updating pathsnavigation_layer
not updating paths
Godot version
4.2-beta1
System information
MacOS 12.3
Issue description
Using a simple
NavigationLink3D
setup I've noticed the following behaviour:Video here. This shows the simple case.
It seems that the only way to recalculate a newly blocked path is to emit some signal and ask those agents to recalculate. That will likely work and I'll be doing that next, however for the following reasons I think this is a bug or incorrect behaviour:
Steps to reproduce
Agent
node and enablewalk
Barrier
node and toggleenable
Barrier/NavigationLink3D:enabled
field, and theBarrier/StaticBody:collision_layer
To underscore the problem, disable the
Barrier/StaticBody3D:collison_layer
while the barrier is enabled and see that the agent walks straight through the barrier even though the link is disabled.Additionally, notice that:
NavigationLink3D:enabled
to false and run the game, toggling with the provided button will not work. The link cannot be turned back on.Minimal reproduction project
https://github.com/wjagodfrey/godot_4_2_beta1_navigation_link_toggle
The text was updated successfully, but these errors were encountered: