diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2023-02-21 21:47:47 -0600 |
---|---|---|
committer | Narr the Reg <juangerman-13@hotmail.com> | 2023-02-21 21:55:23 -0600 |
commit | 739a81055f8f33ab0987ee730370a0535a1bdf05 (patch) | |
tree | 8d7acb47d0b2915112f13aaa9542368cf8c5b8ce /src/core/hid/emulated_controller.cpp | |
parent | 673accd630be88fde4b6b748608a9c3bc42ea60f (diff) |
core: hid: Restore motion state on refresh and clamp motion values
Diffstat (limited to 'src/core/hid/emulated_controller.cpp')
-rw-r--r-- | src/core/hid/emulated_controller.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/core/hid/emulated_controller.cpp b/src/core/hid/emulated_controller.cpp index 6d5a3deadb..a29c9a6f8b 100644 --- a/src/core/hid/emulated_controller.cpp +++ b/src/core/hid/emulated_controller.cpp @@ -363,7 +363,17 @@ void EmulatedController::ReloadInput() { SetMotion(callback, index); }, }); - motion_devices[index]->ForceUpdate(); + + // Restore motion state + auto& emulated_motion = controller.motion_values[index].emulated; + auto& motion = controller.motion_state[index]; + emulated_motion.ResetRotations(); + emulated_motion.ResetQuaternion(); + motion.accel = emulated_motion.GetAcceleration(); + motion.gyro = emulated_motion.GetGyroscope(); + motion.rotation = emulated_motion.GetRotations(); + motion.orientation = emulated_motion.GetOrientation(); + motion.is_at_rest = !emulated_motion.IsMoving(motion_sensitivity); } for (std::size_t index = 0; index < camera_devices.size(); ++index) { |