Log in or register to post comments

UWP Desktop Portrait issue

May 25, 2018 - 5:25am #1

Hello everyone! We are having a quiet an important issue on creating an app for windows 10. We are using unity 10, develloping for UWP.

The probleme is that it works perfectly on our first monitor (see screenShot n°1), which is in landscapeLeft normal mode; but when we pass it on our second screen, which is oriented to portrait, the ARcamera gets rotated 90° counterClockwise, and a 3d GameObject attached to the cam, that should be on the bottom of the screen, gets mirrored on top  of the screen(see screenShot n°2). The Canva, however, is still perfect (on each screenShot, boutons are barely visible, they are the grey boxes on the bottom part of the screen, where the 3d gameObject should be).

 

I've tried to set to autoOrientation in unity, tried to lock it to portrait or to landscapeLeft, but it still doesn't work correctly. When i try to get the deviceInput.Orientation, i always get unknown. SO I've written this piece of code in order to check if vuforia gets when the window is going either to the portrait screen, or to the landscapeLeft screen :

public class RotationScreen : MonoBehaviour

{

public string orientationState;

    public void Awake()

    {

        DontDestroyOnLoad(transform.gameObject);

    }

    // Use this for initialization

    void Start()

    {

        orientationState = VuforiaRuntimeUtilities.ScreenOrientation.ToString();

           Debug.Log("Orientation de l'ecran : "+ orientationState);

          

        Screen.autorotateToLandscapeLeft = false;

        Screen.autorotateToLandscapeRight = false;

        Screen.autorotateToPortrait = false;

        Screen.autorotateToPortraitUpsideDown = false;

        Screen.orientation = ScreenOrientation.LandscapeRight;

    }

    // Update is called once per frame

    void Update()

    {

     

  if (VuforiaRuntimeUtilities.ScreenOrientation.ToString() != orientationState)

        {

            Debug.Log("Nouvelle orientation ! : " + VuforiaRuntimeUtilities.ScreenOrientation.ToString());

            orientationState = VuforiaRuntimeUtilities.ScreenOrientation.ToString();

        }

    }

}

 

It seems to work, and tells me correctly when it's either on the portrait screen or on the landscapeLeft screen.

What I would like is a way to prevent vuforia from rotating the  camera when the window is displayed on the portrait monitor.

I would be really glad if anyone had any clue about that.

Thank you!

 

AttachmentSize
Image icon ScreenShotLandscape.JPG123.64 KB
Image icon ScreenShotPortrait.JPG137.58 KB
Log in or register to post comments