From 51c60f7a49fad577f1c99ef0cf276933913a8b50 Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Tue, 15 Nov 2016 09:24:19 +1100 Subject: [PATCH] Fixed up release motionManager and negate z for gyro and magnetometer --- platform/iphone/app_delegate.mm | 2 +- platform/iphone/os_iphone.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index f65599a35af..453ab85e3f1 100644 --- a/platform/iphone/app_delegate.mm +++ b/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; }; diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index a30d1c7194c..cfd2a844c6b 100644 --- a/platform/iphone/os_iphone.cpp +++ b/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() {