Change NavigationServer2D
avoidance callbacks from Vector3
to Vector2
#107256
+16
−17
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Changes
NavigationServer2D
avoidance callbacks fromVector3
toVector2
.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 theirVector3
parameter toVector2
to not run into an error after this change.Navigation documentation has likely script examples with this that need to be updated as well.