Reputation: 1773
I'd like to develop an app in which I should get iPhone rotation and orientation. Once I get this values, I'd like to make a cube which follows the device rotation/orientation.
Do you know any web site which talks about it? Or do you know where should I search for infos about it..?
Upvotes: 0
Views: 695
Reputation: 534895
Use a CMMotionManager to start getting motion updates. Poll the motion manager using a timer; on each poll, retrieve the motion manager's deviceMotion.attitude
. You can then do whatever you want in response to the device's change in attitude. I believe the most accurate way, if you're going to be moving your image in 3D, is to use OpenGL with the attitude's quaternion
. But if you're just making, say, a level, you can use the rotationMatrix
instead (and apply a transform based on it).
Upvotes: 1