AR Foundation displayMatrix to orientation

 avatar
unknown
csharp
4 years ago
580 B
12
Indexable
Matrix4x4 displayMatrix = args.displayMatrix.Value;
int m00 = Mathf.RoundToInt(displayMatrix[0,0]);
int m01 = Mathf.RoundToInt(displayMatrix[0,1]);

_screenOrientation = ScreenOrientation.LandscapeLeft;

if (m00 == 0) {
    if (m01 == 1) {
        _screenOrientation = TargetIsAndroid ? ScreenOrientation.Portrait : ScreenOrientation.PortraitUpsideDown;
    }
    if (m01 == -1) {
        _screenOrientation = TargetIsAndroid ? ScreenOrientation.PortraitUpsideDown : ScreenOrientation.Portrait;
    }
}
if (m00 == -1) {
    _screenOrientation = ScreenOrientation.LandscapeRight;
}
Editor is loading...