You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a NavigationRegion2D and attempting to rebake the NavigationPolygon at runtime, it behaves differently than it does in the editor. It will use groups in the editor, it will not use groups at runtime.
In the editor, when using the Group with Children or Group Explicit modes, it will correctly bake a navigation polygon that includes the obstacles that are part of the specified group.
Here is an example of baking in the editor:
In the editor, it correctly incorporates the obstacles in this polygon.
However, when then attempting to bake this again through a script at runtime, with the same navigation polygon (and thus the same settings) it seems to ignore all of the nodes in the specified group.
Here is an example of a runtime re-baking:
In that screenshot, it ignores the obstacles completely (the bug.)
I don't believe the issue is within my re-baking script because it does still work when in Root node with children mode:
Unfortunately, the "root node with children" mode includes all polygon2d nodes, which isn't always desirable and why I have been trying to use the explicit groups instead.
Note (possible source of the issue?):
This may be related to an issue I've noticed where the default value for the group, navigation_polygon_source_geometry_group, is sporadically replaced with the similar but different value of navigation_polygon_source_group when re-opening the project or sometimes re-opening or modifying the scene.
For example, in my minimal reproduction project, I am using the default value of navigation_polygon_source_geometry_group but when re-opening the project it changes the group value without any user input:
If it it is also changing/using the incorrect group name at runtime, that might be the root cause of the issue?
I'm happy to provide more context or information if needed. (This is my first time opening an issue so please bear with me.)
Steps to reproduce
Create a NavigationRegion2D
Create a NavigationPolygon within that region, and give it an outline
Set the NavigationPolygon's source_geometry_mode to the Group Explicit mode
Create Polygon2D or StaticBody2D nodes that are members of the default group navigation_polygon_source_geometry_group
Bake the NavigationPolygon in the editor (that part should work)
Write a script to bake it at runtime, then run the program and do a runtime bake (this should fail to include the group)
Reproducing from the minimal reproduction project
Open the project
Reset the main scene's NavigationRegion's NavigationPolygon's source_geometry_group_name to the default value (it keeps changing away from the default value by itself for some reason)
Bake the NavigationPolygon in the editor (it should work)
Run the Project
Press 'R' to run the rebake code at runtime (it will fail to correctly use the items in the group)
(Optionally) Press 'M' to change the source_geometry_mode and rebake in the different modes
(Note, because of the possible bug here, you will need to reset the source_geometry_group_name on the NavigationRegion2D's NavigationPolygon to the default value when opening the project - as it seems to reset itself every time to an incorrect value)
The text was updated successfully, but these errors were encountered:
I have discovered that using the modified group name of navigation_polygon_source_group (for the NavigationPolygon's source group name and the obstacle's groups) does allow re-baking at runtime, but any other group name value (including the default value of navigation_polygon_source_geometry_group will fail.
I suspect this is the cause of the incorrect behavior.
Tested versions
System information
Godot v4.2.stable - Debian GNU/Linux 11 (bullseye) 11 - X11 - Vulkan (Forward+) - integrated Intel(R) HD Graphics 5500 (BDW GT2) () - Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz (4 Threads)
Issue description
When using a NavigationRegion2D and attempting to rebake the NavigationPolygon at runtime, it behaves differently than it does in the editor. It will use groups in the editor, it will not use groups at runtime.
In the editor, when using the
Group with Children
orGroup Explicit
modes, it will correctly bake a navigation polygon that includes the obstacles that are part of the specified group.Here is an example of baking in the editor:
In the editor, it correctly incorporates the obstacles in this polygon.
However, when then attempting to bake this again through a script at runtime, with the same navigation polygon (and thus the same settings) it seems to ignore all of the nodes in the specified group.
Here is an example of a runtime re-baking:
In that screenshot, it ignores the obstacles completely (the bug.)
I don't believe the issue is within my re-baking script because it does still work when in
Root node with children
mode:Unfortunately, the "root node with children" mode includes all polygon2d nodes, which isn't always desirable and why I have been trying to use the explicit groups instead.
Note (possible source of the issue?):
This may be related to an issue I've noticed where the default value for the group,
navigation_polygon_source_geometry_group
, is sporadically replaced with the similar but different value ofnavigation_polygon_source_group
when re-opening the project or sometimes re-opening or modifying the scene.For example, in my minimal reproduction project, I am using the default value of
navigation_polygon_source_geometry_group
but when re-opening the project it changes the group value without any user input:If it it is also changing/using the incorrect group name at runtime, that might be the root cause of the issue?
I'm happy to provide more context or information if needed. (This is my first time opening an issue so please bear with me.)
Steps to reproduce
source_geometry_mode
to theGroup Explicit
modenavigation_polygon_source_geometry_group
Reproducing from the minimal reproduction project
Minimal reproduction project (MRP)
Nav2DBakingIssue.zip
(Note, because of the possible bug here, you will need to reset the
source_geometry_group_name
on the NavigationRegion2D's NavigationPolygon to the default value when opening the project - as it seems to reset itself every time to an incorrect value)The text was updated successfully, but these errors were encountered: