How to get a rotation around the Y axis regarding how the user holds the device?

I remember from WWDC that there was a conversation with a teapot in OpenGL ES that rotated with the movement of the device. He appeared as a teapot stood in space.

When the application started, the kettle entered a certain position. Then, when the device turned, the kettle also turned to stand in space.

In this conversation, they mentioned that we should get a "frame of reference", for example. when you start the application, which tells how the user originally held the device.

For example, the axis of the accelerometer:

accelerometer

I want to know the rotation around the Y axis, but with respect to how the user holds the device. Therefore, when the user holds it vertically and rotates around Y, I need to know this rotation value.

, ? iPhone 4/4S , , CoreMotion .

, Y?

+5
1

CMDeviceMotionHandler CoreMotion? , iOS 4 - iOS5 . , , DeviceMotion, - .

, , CMAttitude multiplyByInverseOfAttitude, CMDeviceMotion . CMAttitude multiplyByInverseOfAttitude . CMDeviceMotion.attitude .

Y , .. CMAttitude.roll. , . , Gimbal Lock. , , , .

+2

All Articles