全方位(左右前後)の傾きを求めたい
私は左と右を見つけるために以下のコードを使用しています
[motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion *deviceMotion, NSError *error)
{
if (deviceMotion.attitude.roll <= -1)
{
[self TiltControl:@"left"];
}
else if(deviceMotion.attitude.roll > 1)
{
[self TiltControl:@"right"];
}
}];
今、どのように前方と後方を見つけることができます...
4つの傾きすべてを見つける最良の方法は何ですか...