Skip to content
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

When moving a NavigationRegion2D the NavigationServer2D does not update. #85545

Closed
xylr117z4 opened this issue Nov 30, 2023 · 4 comments
Closed

Comments

@xylr117z4
Copy link

xylr117z4 commented Nov 30, 2023

Godot version

4.2.stable, 4.2.stable.mono

System information

Godot v4.2.stable.mono - Windows 10.0.19045 - Vulkan (Forward+) - dedicated AMD Radeon RX 5700 XT (Advanced Micro Devices, Inc.; 31.0.22011.4008) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

Issue description

According to the "Using NavigationRegions" documentation https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_using_navigationregions.html

"While changing the transform of a NavigationRegion node does update the region position on the NavigationServer, changing the scale does not."

This is true in 4.1.1.stable
However it is not working in 4.2.stable

Using either a RemoteTransform Node or setting the transform of the region directly.
Does not update the NavigationServer.

I'm using specifically the .Net release of 4.1.1.stable and 4.2.stable
But my scripts are in GDscript, doubt that matters, but just in case.

Steps to reproduce

Create a scene with a NavigationRegion2D.
Add a NavigationPolygon
Add a script which moves the NavigationRegion2D using it's .position variable.
To see the lack of update connect NavigationServer2D.map_changed to any print function.

In 4.1.1 this will emit/print every physics frame in which the map changes.
In 4.2 this will emit/print once on the first frame.

Minimal reproduction project

In the minimal reproduction project you can use the arrow keys to move the NavigationRegion2D around the screen.
The console will print out when NavigationServer2D.map_changed is emitted.

NavigationRegionUpdateBug.zip

@xylr117z4
Copy link
Author

xylr117z4 commented Nov 30, 2023

Just tried using NavigationServer2D.region_set_transform()
NavigationServer2D will emit map_changed however, it does not appear that the region's position actually changes.
It's not reflected with Debug>Show Navigation, nor while printing the region's position.

-Update:
So testing in my actual project. (where I have nav agents using avoidance.)
NavigationServer2D.region_set_transform() does work.
However it does not update the actual region node.

So I'm required to use both server.region_set_transform(new_transform) and region.position = new_position.
For the server to update and for debug>visible navigation to display properly.
Where as previously I could just use region.position = new_position or a RemoteTransform node.

This is still a lose of functionality from 4.1.1.stable to 4.2.stable.
If the change was purposeful, I would request a variable to enable the previous behavior.
Preferably on the NavigationRegion itself as well as the NavigationServer.
So locally and globally.

@smix8
Copy link
Contributor

smix8 commented Nov 30, 2023

The NavigationRegion2D transform notification is currently broken. See pr #85258 that fixes it.

The debug visuals are part of the node, so any change that is done on the server-only will not be shown with the debug. E.g. moving the region with the NavigationServer API will not move the debug. A lot of the debug in Godot is currently node-based and has the same issue because the node updates are usually one-way tickets to the server and not the other way. See proposal godotengine/godot-proposals#7208 that wants to change this.

@smix8 smix8 added bug and removed needs testing labels Nov 30, 2023
@akien-mga akien-mga changed the title [4.2] When moving a NavigationRegion2D the NavigationServer2D does not update. When moving a NavigationRegion2D the NavigationServer2D does not update. Nov 30, 2023
@akien-mga
Copy link
Member

So can this be closed as duplicate of #85242, or does it also cover other issues?

@smix8
Copy link
Contributor

smix8 commented Nov 30, 2023

Yes it is basically a duplicate, that linked issue about the not updating edge connections has the same problem that the transform notification does not work for the NavigationRegion2D.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants