summaryrefslogtreecommitdiff
path: root/modules/mobile_vr
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2017-11-08 12:09:43 +1100
committerBastiaan Olij <mux213@gmail.com>2017-11-08 12:09:43 +1100
commit2965eb28101f2d97cd1ba815d3e7d99c20db10d4 (patch)
tree231c760d4cb241ed59a6731a7cc8ce6767db334e /modules/mobile_vr
parentd4b19d8d830342bcb1812082ac623d81fa8305bc (diff)
Fix has_gyro and has_grav mixup
Diffstat (limited to 'modules/mobile_vr')
-rw-r--r--modules/mobile_vr/mobile_interface.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/modules/mobile_vr/mobile_interface.cpp b/modules/mobile_vr/mobile_interface.cpp
index eb87bb2cf0..93d5c22ef8 100644
--- a/modules/mobile_vr/mobile_interface.cpp
+++ b/modules/mobile_vr/mobile_interface.cpp
@@ -122,6 +122,7 @@ void MobileVRInterface::set_position_from_sensors() {
Vector3 north(0.0, 0.0, 1.0); // North is Z positive
// make copies of our inputs
+ bool has_grav = false;
Vector3 acc = input->get_accelerometer();
Vector3 gyro = input->get_gyroscope();
Vector3 grav = input->get_gravity();
@@ -143,14 +144,17 @@ void MobileVRInterface::set_position_from_sensors() {
// what a stable gravity vector is
grav = acc;
if (grav.length() > 0.1) {
- has_gyro = true;
+ has_grav = true;
};
} else {
- has_gyro = true;
+ has_grav = true;
};
bool has_magneto = magneto.length() > 0.1;
- bool has_grav = grav.length() > 0.1;
+ if (gyro.length() > 0.1) {
+ /* this can return to 0.0 if the user doesn't move the phone, so once on, it's on */
+ has_gyro = true;
+ };
#ifdef ANDROID_ENABLED
///@TODO needs testing, i don't have a gyro, potentially can be removed depending on what comes out of issue #8101