I'm trying to write an augment reality app for iOS tablet. For this I use AVFoundation classes to translate video from camera to screen. The augment objects are simple UILabels
"flying in the air". It must look like the labels are in front of you and save the position even if you rotate the tablet. As usual i'm using CMMotionManager
to capture device gyroscope data.
My problem is - I can't correctly apply device rotation quaternion to the flying UILabel
s.
The labels are rotating around they own axes, but they must rotate "around the tablet axes".
How to describe this mathematically? For now i only have an idea of a imaginary sphere that is around the tablet, the labels are positioned on this sphere and when you rotate the tablet than this imaginary sphere is rotating with labels in opposite direction around the same axis.
I don't wanna use any 3rd party libs.
At the end i decided to use this library: https://github.com/antonholmquist/rend-ios. Its not that easy to make this task on pure UIKit.