I was looking for algorithm to apply additional rotation to model with current rotation matrix, and found this:
1
2 3 |
GLKVector3 up = GLKVector3Make(0.f, 1.f, 0.f);
up = GLKQuaternionRotateVector3( GLKQuaternionInvert(quarternion), up ); GLKQuaternion quarternion = GLKQuaternionMultiply(quarternion, GLKQuaternionMakeWithAngleAndVector3Axis(delta.x * RADIANS_PER_PIXEL, up)); |
It’s from this small tutorial about rotation:
A bit modified code, source here
Under code a bit more text and links
Continue reading