diff options
author | Marcus Brummer <mbrlabs7@gmail.com> | 2021-03-16 21:08:55 +0100 |
---|---|---|
committer | Marcus Brummer <mbrlabs7@gmail.com> | 2021-03-17 14:05:05 +0100 |
commit | fda2743fef8fbcf0ba5fb4ac93a613ad61735fff (patch) | |
tree | 2f44bc567f7ebf2b46474610df0b5bd47d983638 /platform/uwp | |
parent | fbba496db5bf904d54993145f5bb52a1709f7364 (diff) |
Converted sensor acceleration units to m/s^2 on iOS and UWP
This is beacuse on Android these values are already in m/s^2 while on
iOS and UWP they are in g. This just makes the behaviour consistent on
all platforms.
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/os_uwp.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index fa97948395..33992069f9 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -62,6 +62,8 @@ using namespace Windows::Devices::Sensors; using namespace Windows::ApplicationModel::DataTransfer; using namespace concurrency; +static const float earth_gravity = 9.80665; + int OS_UWP::get_video_driver_count() const { return 2; } @@ -372,9 +374,9 @@ void OS_UWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sende AccelerometerReading ^ reading = args->Reading; os->input->set_accelerometer(Vector3( - reading->AccelerationX, - reading->AccelerationY, - reading->AccelerationZ)); + reading->AccelerationX * earth_gravity, + reading->AccelerationY * earth_gravity, + reading->AccelerationZ * earth_gravity)); } void OS_UWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) { |