문제

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..?

도움이 되었습니까?

해결책

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).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top