Matrix + Quaternions Demo
Achieved using Matrix Rotations and Quaternions
Matrix Operations
The math operations below perform the required transformation to rotate each object around each axis.
The below produces a composite rotation matrix, multiplied in the order ZYX, which is then multiplied by each game object's column vector.
The resulting transformation is relative to the rotation based on each object's current position.
Quaternions
Quaternions are used to preserve object orientation and were used in lieu of Euler Angles, to avoid the axial limitations imposed by Gimbal Lock.
The below produces a composite Quaternion , due to the non-commutative nature of Quaternions, and Unity's coordinate system, a permutation was required to achieve the desired rotation.