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
I have numerous "bridges" (meshes with NavigationRegion3D) that start life disabled (NavigationRegion3D.enabled = false).
In Godot 4.1 I could enable these bridges in script when the player triggered an action, and the NavigationRegion3D would correctly enable with edge connections allowing NPCs to walk across the bridge.
In Godot 4.2 if the NavigationRegion3D is saved disabled then enabling/disabling fails to enable edge connections. I suspect the bug may have been introduced by #77191 in NavigationRegion3D::_region_enter_navigation_map. This function only registers the region with the world-map if the region is enabled when it enters the tree. Enabling at a later time does not register the region.
Steps to reproduce
Attached is a simple demo project. When loaded the main scene shows the following three navigation regions and their edge connections:
Toggling the enable on region 1 works as expected:
Save the scene with region 1 disabled; then close and reopen it:
Toggling the enable on region 1 fails to enable the edge connections:
Inspecting NavigationRegion3D::set_enabled() shows that it implements enabling and disabling of regions via NavigationServer3D::get_singleton()->region_set_enabled(region, enabled);.
As such I suspect NavigationRegion3D::_region_enter_navigation_map() should always register the region with the map using the NavigationServer3D::get_singleton()->region_set_map(region, xxx);, but should follow it up with a NavigationServer3D::get_singleton()->region_set_enabled(region, enabled); call.
This PR fixes issue godotengine#83364 by always registering the region when it enters the tree, and instead using region_set_enabled to control whether its enabled. The same logical changes have been applied to NavigationRegion2D.
This PR fixes issue godotengine#83364 by always registering the region when it enters the tree, and instead using region_set_enabled to control whether its enabled. The same logical changes have been applied to NavigationRegion2D.
Godot version
4.2-beta.1
System information
Windows 11, Vulkan Mobile, NVidia RTX 3070 TI
Issue description
I have numerous "bridges" (meshes with NavigationRegion3D) that start life disabled (NavigationRegion3D.enabled = false).
In Godot 4.1 I could enable these bridges in script when the player triggered an action, and the NavigationRegion3D would correctly enable with edge connections allowing NPCs to walk across the bridge.
In Godot 4.2 if the NavigationRegion3D is saved disabled then enabling/disabling fails to enable edge connections. I suspect the bug may have been introduced by #77191 in
NavigationRegion3D::_region_enter_navigation_map
. This function only registers the region with the world-map if the region is enabled when it enters the tree. Enabling at a later time does not register the region.Steps to reproduce
Attached is a simple demo project. When loaded the main scene shows the following three navigation regions and their edge connections:
Toggling the enable on region 1 works as expected:
Save the scene with region 1 disabled; then close and reopen it:
Toggling the enable on region 1 fails to enable the edge connections:
Minimal reproduction project
NavRegionDisabledBug.zip
The text was updated successfully, but these errors were encountered: