I have an image that I want to rotate, about its centre point, in 3D depending on the roll/pitch/yaw of the iPhone.
Which is the preferred solution: CGAffineTransform or CATransform3D?
Are there any examples I can follow. There are numerous posts that allude towards a solution.
The image for simplicity's sake the image is a rectangle.
Many thanks.
CoreMotion gives device's current attitude (with yaw, pitch ,roll, in eulerian mode or as quaternion rotation). These are 3 different ways to express the same thing. What you need to do is to apply the transformations correctly to reflect the device's current attitude. Consider this sample.
To reproduce it is necessary to create UIViews (
rect1,rect2) in the Storyboard, hook them up to the viewController. As you rotate the device, these views will be transformed accordingly. You may try CMQuaternion (m.attitude.quaternion) to do similar job.