Skip to content

Add angle distance functions #7092

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

Conversation

samme
Copy link
Contributor

@samme samme commented Mar 31, 2025

This PR

  • Adds a new feature

After #7091 I thought there should be a way to make a rotation in one direction or another.

New Features

  • Phaser.Math.Angle.GetClockwiseDistance() gets the shortest nonnegative angular distance between two angles.
  • Phaser.Math.Angle.GetCounterClockwiseDistance() gets the shortest nonpositive angular distance between two angles.
  • Phaser.Math.Angle.GetShortestDistance() gets the shortest signed angular distance between two angles. (This is like Phaser.Math.Angle.ShortestBetween() but in radians.)

Tests

@samme samme force-pushed the feature/v4.0.0/math-angle-distances branch from f5bf394 to bf92829 Compare April 1, 2025 16:41
@zekeatchan zekeatchan merged commit cbe6d08 into phaserjs:v4.0.0 Apr 3, 2025
@zekeatchan
Copy link
Collaborator

zekeatchan commented Apr 3, 2025

Hi @samme. Thanks for the PR. We have merged it with the v4.0.0 and also added it to the master branch. It will be part of the next release. Do test it out and let us know if you encounter any issues.

zekeatchan added a commit that referenced this pull request Apr 3, 2025
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.

2 participants