diff options
author | bunnei <bunneidev@gmail.com> | 2021-12-21 09:13:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-21 09:13:54 +0100 |
commit | 5e24f7ed3106542838a557dd2cc872e7e338fbb5 (patch) | |
tree | ac773436f7767a0d5c6c411f0717269cbd19f29a /src/core/hid/motion_input.cpp | |
parent | Merge pull request #7609 from Tatsh/file-assoc (diff) | |
parent | service/hid: Improve console motion accuracy (diff) | |
download | yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar.gz yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar.bz2 yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar.lz yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar.xz yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.tar.zst yuzu-5e24f7ed3106542838a557dd2cc872e7e338fbb5.zip |
Diffstat (limited to 'src/core/hid/motion_input.cpp')
-rw-r--r-- | src/core/hid/motion_input.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/hid/motion_input.cpp b/src/core/hid/motion_input.cpp index c25fea966..a23f192d7 100644 --- a/src/core/hid/motion_input.cpp +++ b/src/core/hid/motion_input.cpp @@ -23,11 +23,11 @@ void MotionInput::SetAcceleration(const Common::Vec3f& acceleration) { } void MotionInput::SetGyroscope(const Common::Vec3f& gyroscope) { - gyro = gyroscope - gyro_drift; + gyro = gyroscope - gyro_bias; // Auto adjust drift to minimize drift if (!IsMoving(0.1f)) { - gyro_drift = (gyro_drift * 0.9999f) + (gyroscope * 0.0001f); + gyro_bias = (gyro_bias * 0.9999f) + (gyroscope * 0.0001f); } if (gyro.Length2() < gyro_threshold) { @@ -41,8 +41,8 @@ void MotionInput::SetQuaternion(const Common::Quaternion<f32>& quaternion) { quat = quaternion; } -void MotionInput::SetGyroDrift(const Common::Vec3f& drift) { - gyro_drift = drift; +void MotionInput::SetGyroBias(const Common::Vec3f& bias) { + gyro_bias = bias; } void MotionInput::SetGyroThreshold(f32 threshold) { @@ -192,6 +192,10 @@ Common::Vec3f MotionInput::GetGyroscope() const { return gyro; } +Common::Vec3f MotionInput::GetGyroBias() const { + return gyro_bias; +} + Common::Quaternion<f32> MotionInput::GetQuaternion() const { return quat; } |