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

Mathf.AngleBetweenVectors() does not compute the angle between vectors #747

Open
Diamond-Wolf opened this issue Oct 13, 2022 · 1 comment

Comments

@Diamond-Wolf
Copy link

What it does is take the second vector, subtract it from the first, and compute the angle from 0 to the resulting vector via atan2. This is not correct e.g. when the vectors are 90 degrees apart. If you have vectors (0,1) and (1,0), it will subtract the two, then compute atan2(-1,1). This is 135 degrees, not 90. Changing the length of either vector will also change the resulting angle, even though the actual angle is not changing.

@Cremetoertchen0815
Copy link

I believe this is a misunderstanding of the terminology. Vectors can be position vectors or direction vectors. This method calculates the angle between two position vectors by forming the direction vector and then calculating the angle.
Maybe a bit confusing, but not false!

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

No branches or pull requests

2 participants