Skip to content

Change NavigationServer2D avoidance callbacks from Vector3 to Vector2 #107256

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

Merged
merged 1 commit into from
Jun 8, 2025

Conversation

smix8
Copy link
Contributor

@smix8 smix8 commented Jun 7, 2025

Changes NavigationServer2D avoidance callbacks from Vector3 to Vector2.

This was always an oddball close to a bug that no one wanted to change because it would be a (small) compatibility break.

It was the result of the NavigationServer2D using the NavigationServer3D behind the scene and no one adding a Vector2 callback to the api for 2d. It caused frequent annoyance for 2d users that tried to use it not expecting a Vector3 from a NavigationServer2D. E.g. raised in issues like #106250.

Now with the major change of a dedicated NavigationServer2D added in Godot 4.5 it is good time to change this as well.

NavigationAgent2D users are not affected as this is just the internals changing.

Projects that use the NavigationServer2D.agent_set_avoidance_callback() to create custom callbacks need to change their Vector3 parameter to Vector2 to not run into an error after this change.

Navigation documentation has likely script examples with this that need to be updated as well.

Changes 2D avoidance callbacks from Vector3 to Vector2.
@smix8 smix8 force-pushed the avoidance2dcallback branch from d8d296f to 0ce53ff Compare June 7, 2025 12:22
@smix8 smix8 requested a review from a team as a code owner June 7, 2025 12:22
@smix8 smix8 added this to the 4.5 milestone Jun 7, 2025
Copy link
Member

@AThousandShips AThousandShips left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, the compatibility should be documented but I think it's worth breaking compatibility here, the callback should trigger an error if called with the wrong arguments unless I'm mistaken (worth testing) so it shouldn't be invisible

Don't think it's worth adding a whole new method to handle the new case and keeping the old one for compatibility

@akien-mga akien-mga merged commit 151db00 into godotengine:master Jun 8, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@smix8 smix8 deleted the avoidance2dcallback branch June 9, 2025 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants