xr-unity icon indicating copy to clipboard operation
xr-unity copied to clipboard

Feature:autorotation

Open guillaume-- opened this issue 6 years ago • 6 comments

objects are stretched/squeezed when switching between portrait and landscape modes screenshot_20180917-121419_8thwall 1 screenshot_20180917-121453_8thwall 1

arcore 1.4 android 8.1 unity 2018.1.4f1 8thwall xr 8.1.1.216

guillaume-- avatar Sep 17 '18 00:09 guillaume--

8th Wall XR does not currently support autorotation. We suggest selecting the desired orientation just before loading the scene where you would like to run the XR engine, then locking that orientation through the lifetime of that scene.

mralbean avatar Sep 17 '18 17:09 mralbean

Are there any updates on official support for this?

zeroregard avatar Feb 26 '19 10:02 zeroregard

Any known hacks for this whatsoever? @mralbean We managed to get it working on iOS but not on Android: https://gist.github.com/mathiassiig/adc574fb3af179526fad4611273d84b9

zeroregard avatar Mar 13 '19 14:03 zeroregard

We currently don't have any updates to offer with official support of autorotation while an AR session is running.

What we suggest to do is detect the device orientation just before loading your AR scene, then lock the orientation for the duration of the AR scene. For example, if your application is set to autorotate, you can do something like this at the time you load your AR scene:

void Run(String scene) {
      // Lock orientation to current device orientation prior to loading AR scene 
      switch (Input.deviceOrientation) {
        case DeviceOrientation.Portrait:
          Screen.orientation = ScreenOrientation.Portrait;
          break;
        case DeviceOrientation.PortraitUpsideDown:
          Screen.orientation = ScreenOrientation.PortraitUpsideDown;
          break;;
        case DeviceOrientation.LandscapeLeft:
          Screen.orientation = ScreenOrientation.LandscapeLeft;
          break;;
        case DeviceOrientation.LandscapeRight:
          Screen.orientation = ScreenOrientation.LandscapeRight;
          break;;
        default:
          // If Unknown, just set to Portrait
          Screen.orientation = ScreenOrientation.Portrait;
          break;
      }
    SceneManager.LoadScene(scene);
  }

mralbean avatar Mar 13 '19 18:03 mralbean

That's only useful if you're working on an app with partial AR

zeroregard avatar Mar 14 '19 08:03 zeroregard

Any update on this issue? this issue still exists in the 11.2 release.

viknesh2020 avatar Aug 01 '19 12:08 viknesh2020