mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
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.
This commit is contained in:
parent
fbba496db5
commit
fda2743fef
3 changed files with 20 additions and 8 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue