Search Unity

HoloLens Menu Centered

Discussion in 'VR' started by Jarediavionic, Apr 17, 2018.

  1. Jarediavionic

    Jarediavionic

    Joined:
    Jan 6, 2017
    Posts:
    71
    Hey guys,

    I am working on creating an app in hololens however I am having trouble get the menu centered. We have it setup to where the user can either walk or use a Xbox controller. The issue is that the button used to enable/disable the menu doesn't always place it in the screen center. I fear that since we have the camera is the child of the empty game object that is used to move the camera, that it is causing issues with the alignment.

    I am thinking of attempting to it create when pressed very similar to the TaptoPlace script and have it Destroy upon closing. I just need the menu to be centered when called upon. Any thoughts or advice would be amazing. Thank you for your time

    The best result i have got so far is the following script:


    Code (CSharp):
    1.                 if (controllerInput.GetButton(ControllerButton.View))
    2.                 {
    3.                     Menu.SetActive(true);
    4.                     Menu.transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, Camera.main.nearClipPlane + 0.5f));
    5.                 }
    6.  
     
  2. Jarediavionic

    Jarediavionic

    Joined:
    Jan 6, 2017
    Posts:
    71
    Thanks guys, ended up getting it using the gamemanager as reference. Greatly appreciate the help