From 20ad425407969ca8786055348a94af60911fe0d3 Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Wed, 11 Feb 2015 16:28:43 +0800 Subject: [PATCH] Fixed Accelerometer has lagged on iOS --- cocos/platform/ios/CCDevice-ios.mm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cocos/platform/ios/CCDevice-ios.mm b/cocos/platform/ios/CCDevice-ios.mm index f991493bb4..471f41e8f1 100644 --- a/cocos/platform/ios/CCDevice-ios.mm +++ b/cocos/platform/ios/CCDevice-ios.mm @@ -38,6 +38,8 @@ #import #import +#define SENSOR_DELAY_GAME 0.02 + @interface CCAccelerometerDispatcher : NSObject { cocos2d::Acceleration *_acceleration; @@ -69,6 +71,7 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher; if( (self = [super init]) ) { _acceleration = new cocos2d::Acceleration(); _motionManager = [[CMMotionManager alloc] init]; + _motionManager.accelerometerUpdateInterval = SENSOR_DELAY_GAME; } return self; }