I've got Core Motion manager in my iOS app:
motionManager = [[CMMotionManager alloc] init];
motionManager.deviceMotionUpdateInterval = 1.0 / 60.0;
if ([motionManager isDeviceMotionAvailable]) {
[motionManager startDeviceMotionUpdates];
}
and in update method (I'm using cocos3d, but it does not matter) I've got this:
-(void) updateBeforeTransform:(CC3NodeUpdatingVisitor *)visitor
{
if (motionManager.deviceMotionActive)
{
CMDeviceMotion *deviceMotion = motionManager.deviceMotion;
CMAttitude *attitude = deviceMotion.attitude;
NSLog(@"%f, %f, %f", attitude.yaw, attitude.pitch, attitude.roll);
}
}
I put device on table and start to watch yaw, pitch and roll values, and the yaw is constantly changing! it is changing for about 10 degrees in couple of minutes, and it is absolutely inadmissibly in my app. What is the reason of that changing and how can I avoid it? I started to think that it happens because of Earth rotation, but the speed is too much :)
Thanks in advance!