Open kezzyhko opened 1 year ago
I have found the similar issue on different Accelerometer types in Android So, alternative API would be the following:
public static void Start(SensorSpeed sensorSpeed, OrientationSensorType? orientationSensorType);
public enum OrientationSensorType
{
GeomagneticOrientation = 0,
GameOrientation = 1,
}
OrientationSensor.Start(SensorSpeed.Game, OrientationSensorType.GameRotationVector);
And on other platforms where it is not supported, it would fall back to OrientationSensorType.Geomagnetic
Description
On Android, there are multiple different orientation sensors: one uses magnetometer and one does not. The latter allows you to get phone's orientation relative to some fixed reference, not using Earth's magnetic field.
So I propose exposing this feature through MAUI API by GameOrientationSensor, which works using Game Rotation Vector.
Public API Changes
I imagine the API would look the same as normal OrientationSensor, so
Intended Use-Case
For some applications (usually games), the app does not need to know how the phone is oriented relative to north, it just needs some relative orientation. Sacrifising allignment to north, it is possible to get more stable and more percise orientation. It allows for more pleasant character controls, without random rotating/drifting due to uncalibrated compass.