-
Notifications
You must be signed in to change notification settings - Fork 211
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
Vector2::ZERO.normalized()
returns Vector2(NaN, NaN)
#1080
Comments
gdnative is currently in maintenance mode (if at all), meaning we're quite hesitant to apply any changes that can be potentially breaking. This behavior has existed for a long time, and it's possible that some code relies on it. It's also documented as such (even if not explicitly, but that expression is NaN as well): May I ask in which context you encountered this? |
Note that in gdext (Godot 4 bindings), we indeed have multiple overloads with very explicit docs: |
I have methods for pulling/pushing bodies towards/away from a specified position, and when that position is equal |
We could maybe add a Documenting would be a good idea, too. |
@Shou are you interested in a PR that adds |
In Godot,
Vector2.ZERO.normalized()
returnsVector2.ZERO
but the Rust equivalent usesglam
which seems to be the cause for returningNaN
(but I haven't verified). If that's the case, we should probably usenormalize_or
and return zero as the fallback instead.This affects any function that uses
normalized()
as well, likedirection_to()
.The text was updated successfully, but these errors were encountered: