Explanation of Quaternion.ToAngleAxis(), what it does, when to use.


Just wondering if anyone can provide a little more information on what this function does and when to use it. Also, what exactly is an ‘angle-axis representation of the rotation’?


A lot people seem to have problems to understand what a quaternion actually is. I always suggest to first watch this Numberphile video. It should cover the basics in the most understandable way I’ve ever seen.

A quaternion actually represents a vector \ axis and an angle around that axis but as a 4 dimensional complex number.

ToAngleAxis just extracts the angle as well as the axis that this quaternion represents

It just converts your rotation to a different format. For instance if you are not looking for a Quaternion.Euler Vector 3 but your code is calculating some Axsis instead you can use this to get the axis and angle.

What the example in the documentation does is it sets up to variables and then populates them with the angle and axis of the current transform.