I’m trying to use the quaternion.toangleaxis command to obtain the angle of rotation around the Z axis. The problem is that the angle being reported ranges from 0->359->0 (or 359->0->359 when rotating in the opposite direction) for every two revolutions around the axis. In other words, during the first revolution the angle counts toward 359, and then counts backwards to zero on the second revolution.
I think this may be caused by the ‘normal’ of the quaternion being inverted every second revolution, although I’m probably wrong because I dont really understand quaternions (or normals :)).
Can anyone tell me why this is happening and how I can get a range of 0->359 for each revolution.
You’ll probably find that when the angle reverses direction, the axis flips around the other way as well, and that ensures that when read together, the angle and axis give the result you’d expect. This is apparently down to the four dimensional nature of quaternions, in which (as I understand it) any given rotation in 4D space yields two equivalent but opposing rotations in 3D space, and one rotation around the 4D sphere will give you one 3D rotation on one side and the other on the opposite side.