소스 검색

Fixed up release motionManager and negate z for gyro and magnetometer

BastiaanOlij 8 년 전
부모
커밋
51c60f7a49
2개의 변경된 파일6개의 추가작업 그리고 3개의 파일을 삭제
  1. 1 1
      platform/iphone/app_delegate.mm
  2. 5 2
      platform/iphone/os_iphone.cpp

+ 1 - 1
platform/iphone/app_delegate.mm

@@ -332,7 +332,7 @@ static int frame_count = 0;
 	if (motionInitialised) {
 		///@TODO is this the right place to clean this up?
     [motionManager stopDeviceMotionUpdates];
-    // no free ?
+    [motionManager release];
     motionManager = nil;
     motionInitialised = NO;	
 	};

+ 5 - 2
platform/iphone/os_iphone.cpp

@@ -325,6 +325,7 @@ static const float ACCEL_RANGE = 1;
 
 void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
 
+	///@TODO I've made the Z negative like the original accelerometer code, this probably needs more work
 	input->set_accelerometer(Vector3(p_x / (float)ACCEL_RANGE, p_y / (float)ACCEL_RANGE, -p_z / (float)ACCEL_RANGE));
 
 	/*
@@ -365,11 +366,13 @@ void OSIPhone::update_accelerometer(float p_x, float p_y, float p_z) {
 };
 
 void OSIPhone::update_magnetometer(float p_x, float p_y, float p_z) {
-	input->set_magnetometer(Vector3(p_x, p_y, p_z));
+	///@TODO I've made the Z negative like the original accelerometer code, this probably needs more work
+	input->set_magnetometer(Vector3(p_x, p_y, -p_z));
 };
 
 void OSIPhone::update_gyroscope(float p_x, float p_y, float p_z) {
-	input->set_gyroscope(Vector3(p_x, p_y, p_z));
+	///@TODO I've made the Z negative like the original accelerometer code, this probably needs more work
+	input->set_gyroscope(Vector3(p_x, p_y, -p_z));
 };
 
 void OSIPhone::delete_main_loop() {