Fixed up release motionManager and negate z for gyro and magnetometer

This commit is contained in:
BastiaanOlij 2016-11-15 09:24:19 +11:00
parent 5c13bae8df
commit 51c60f7a49
2 changed files with 6 additions and 3 deletions

View File

@ -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;
};

View File

@ -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() {