- Home /
Determine degrees rotated around an arbitrary axis
Setup:
The thick orange line is my arbitrary axis.
The purple dot is the point which needs the angle determined.
Question: Given the point Purple, how far is it rotated around the arbitrary axis Orange? How do I calculate how far purple is rotated around orange?
I know there is the function Quaternion.AngleAxis() which allows you to rotate something around an arbitrary axis by a given angle. My situation needs to reverse engineer that, to figure out what the rotation is.
I imagine I'll have to translate everything towards the origin, then rotate everything so that the axis lies on either X, Y or Z, then calculate the rotation of Purple around that axis, but I'm wondering if Unity has a built in helper that does this computation for me, or if I'll have to slog it out and manually do the transforms and rotations.
Anyone handled this situation before?
Your answer
![](https://koobas.hobune.stream/wayback/20220612100216im_/https://answers.unity.com/themes/thub/images/avi.jpg)