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

Implement Vector2i/3i/4i methods: distance_to and distance_squared_to #83163

Merged
merged 1 commit into from Jan 3, 2024

Conversation

Chubercik
Copy link
Contributor

This pull request implements distance_to and distance_squared_to methods for Vector2i, Vector3i and Vector4i.

Partially implements #2297, closes #7983.

@Chubercik Chubercik requested review from a team as code owners October 11, 2023 18:43
@Chubercik
Copy link
Contributor Author

BTW I'm having some trouble squashing the commits - rebase ends up creating two more commits instead of merging them into one. Any suggestions?

@AThousandShips
Copy link
Member

AThousandShips commented Oct 11, 2023

You need to use git push --force, you're merging the local and remote branches

@Chubercik
Copy link
Contributor Author

Thanks, that did the trick.

@Chubercik Chubercik requested a review from a team as a code owner October 12, 2023 11:45
@lawnjelly
Copy link
Member

lawnjelly commented Oct 12, 2023

Note this still needs proposal approval to go foward:
godotengine/godot-proposals#2297 (comment)

(sorry this comment was primarily addressed at reviewers, rather than author)

@Chubercik
Copy link
Contributor Author

I am aware of that but I don't see how I can further the cause at this point; many people across both linked proposals agree that the addition of distance_to and distance_squared_to makes sense, especially after adding length and length_squared.

Knowing the distance between two points on a grid seems like a very basic functionality for any cell-based game, so it's not like there aren't any real use cases.

If Godot's team's consensus is that such arguments aren't strong enough to go through with this PR, it can be closed or left hanging until stronger argumentation arises, no hard feelings.

@Chubercik
Copy link
Contributor Author

Chubercik commented Dec 14, 2023

Also, a certain other game engine has these methods implemented, which might be considered an argument for also having them in Godot:

Copy link
Member

@Geometror Geometror 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 to me (especially after #53618 got merged), use cases are obvious IMO.

@AThousandShips
Copy link
Member

For parity I'd suggest adding the same to godot-cpp

@akien-mga akien-mga modified the milestones: 4.x, 4.3 Jan 2, 2024
@akien-mga akien-mga merged commit 22e880a into godotengine:master Jan 3, 2024
15 checks passed
@akien-mga
Copy link
Member

Thanks!

@Chubercik Chubercik deleted the vectorXi_dist_methods branch January 3, 2024 10:48
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.

Add a distance_to() method to Vector2i
5 participants