Everyone tells me that I don't need to know what four separate parts of the quaternion mean in Unity. But I want to know it, the built-in methods in Unity don't solve some of my tasks. Tell me, please, where can I read about it?
CodePudding user response:
There are 4 parts, called w, x, y and z.
x, y and z represent a normalized vector in 3d space and are 3 imaginary components of the quaternion. x represents the x-axis etc.
The w component represents a rotation around the axis shown by the vector (x,y,z) in radians, anticlockwise, and is the real part of the number.
Quaternions exist in a system of mathematics where there are 3 imaginary numbers: i, j and k, each of which can be squared to get -1, and where ijk = -1 as well. w, x, y and z are real numbers, to create a Quaternion:
w xi yj zk
These quaternions are multiplied to do rotations (the order of multiplication is important).
For practical purposes, you are unlikely to need to modify the components directly, it would often be simpler to do the calculations in Euler and then convert to Quaternion. It is good to know what they mean though, so here are some Wikipedia links (unity quaternions, are, at the end of the day, just normalized quaternions):