Document toolboxDocument toolbox

2023.1.1571.2 DQuaternion



Overview

The Unity Quaternion in double values.

Can be used to indicated describe rotation.


Description

Quaternion is a description of rotation that does not have a Gimbal Lock problem.

This is achieved by describing a rotation not as a rotation over multiple axis, but describing one axis in (x,y,z) with a rotation over it.


Tips

Adding rotation is done by multiplying them with the rule given below. This is because the rotation applied to A * B means the rotation of B is applied over A’s space so it’s x,y,z direction have already been rotated by A’s rotation.

DQuaternion a, b; a * b != b * a

Two methods to determine difference between 2 rotation:

//rotation applied after old rotation (local space) DQuaternion diff = DQuaternion.Inverse(oldRotation) * newRotation; //if determine difference like this use the following newRotation == oldRotation * diff
//rotation applied before old rotation (global space) DQuaternion diff = newRotation * DQuaternion.Inverse(oldRotation); //if determine difference like this use the following newRotation == diff * oldRotation

 

Prespective Documentation