iOS: Feed the gyroscope into tilt input

Same as Android: rotation rates go to NativeGyroscope, and SYSPROP_HAS_GYRO shows the "Use gyroscope" option.

Accelerometer data is now scaled from g to m/s^2, like Android's. Tilt normalizes it, but the gyro fusion only trusts the accelerometer when it reads about 9.81, so in g it would never correct drift.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-21 14:00:33 +02:00
1 parent 3647b9e8a4
commit cdf9d38dca
5 files changed
+42 -1

No files matched your search

+19
View File
@@ -312,6 +312,21 @@ static int GetPickerRequestId(id picker) {
} else {
INFO_LOG(Log::G3D, "No accelerometer available, not starting updates.");
}
if (self.motionManager.gyroAvailable) {
self.motionManager.gyroUpdateInterval = 1.0 / 60.0;
INFO_LOG(Log::G3D, "Starting gyro updates.");
// Same serial queue as the accelerometer, so the two don't race in the tilt fusion.
[self.motionManager startGyroUpdatesToQueue:self.accelerometerQueue
withHandler:^(CMGyroData *gyroData, NSError *error) {
if (error) {
NSLog(@"Gyro error: %@", error);
return;
}
ProcessGyroData(gyroData);
}];
}
#endif
// Spin up the render thread, which in turn starts the emu thread.
@@ -328,6 +343,10 @@ static int GetPickerRequestId(id picker) {
INFO_LOG(Log::G3D, "Stopping accelerometer updates");
[self.motionManager stopAccelerometerUpdates];
}
if (self.motionManager.gyroActive) {
INFO_LOG(Log::G3D, "Stopping gyro updates");
[self.motionManager stopGyroUpdates];
}
#endif
}