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

Add methods to vector2i for consistency with vector2 #47653

Closed
wants to merge 1 commit into from

Conversation

likeich
Copy link
Contributor

@likeich likeich commented Apr 5, 2021

Implements the Vector2i side of proposal # 2297 by adding the following methods to Vector2i that already exist in Vector2 and exposing them to GDScript:

angle
angle_to
angle_to_point
cross
distance_to
distance_squared_to
dot
length
length_squared
posmodv
snapped

These methods were chosen based on discussions in proposal godotengine/godot-proposals#2297

Below is a project that I used for testing.

Vector2iTest.zip

If this PR is accepted then I will start work on the Vector3i portion of this.

@likeich likeich requested a review from a team as a code owner April 5, 2021 23:50
Implements the Vector2i side of # 2297 by adding the following methods that already exist in Vector2 and exposing them to GDScript:

angle
angle_to
angle_to_point
cross
distance_to
distance_squared_to
dot
length
length_squared
posmodv
snapped

These methods were chosen based on discussions in proposal # 2297

Below is a project that I used for testing.

If this PR is accepted then I will start work on the Vector3i portion of this.
@likeich likeich force-pushed the vector2i_new_methods branch from 1240324 to 3ed6892 Compare April 5, 2021 23:53
@Calinou Calinou added this to the 4.0 milestone Apr 5, 2021
@aaronfranke aaronfranke self-requested a review April 6, 2021 22:32
@akien-mga
Copy link
Member

Partially superseded by #53618.

After discussion we decided not to implement dot/cross/angle methods on Vector2i as the use case for them in integer math is not clear, and consistency is not a strong enough incentive to add those methods if they're not useful. The discussion can continue in the proposal to see if some users would actually have a use case for more of these methods beyond length() and length_squared().

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