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

Vector2Angle returns degrees instead of radians, but all other raymath #2193

Merged
merged 1 commit into from
Dec 6, 2021

Conversation

schveiguy
Copy link
Contributor

functions use radians, making this awkward to use.

Per discussion on discord, raymath should always use radians. I found this one was left out by searching for 180 and 360.

functions use radians, making this awkward to use.
@raysan5 raysan5 merged commit fa7337e into raysan5:master Dec 6, 2021
@raysan5
Copy link
Owner

raysan5 commented Dec 6, 2021

@schveiguy Good catch! I missed that one. Actually, there is an open issue that could be related: #2172

@schveiguy
Copy link
Contributor Author

Actually, there is an open issue that could be related

that doesn't look like they were expecting radians, just like it returns 90° when it should return 0°

Changing that to the equivalent radians will not solve that problem. It seems like the math might be wrong?

@jdeokkim
Copy link
Contributor

jdeokkim commented Dec 7, 2021

graph

@raysan5 I believe atan2f(v2.y, v2.x) - atan2f(v1.y, v1.x) is the correct way to retrieve an angle between two vectors, based on the defintion of the arc tangent. Here's an article about it from Stack Overflow: https://stackoverflow.com/questions/21483999/using-atan2-to-find-angle-between-two-vectors/21486462

@schveiguy schveiguy deleted the fixraymathdegrees branch January 15, 2022 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants