Search Unity

Question How can I make UI in VR move like the Quests

Discussion in 'VR' started by Josh65, Oct 18, 2021.

  1. Josh65

    Josh65

    Joined:
    Jul 5, 2020
    Posts:
    13
    I want to make a UI that rotates so that it stays in front of the user view. So far I got a script that works but it will rotate and move on all axis when I want to only move horizontally and rotate so that it flat to the user. Oculus Quests guardian systems and some other menus is how I want it to work on my one.
     
  2. colinleet

    colinleet

    Joined:
    Nov 20, 2019
    Posts:
    189
  3. Josh65

    Josh65

    Joined:
    Jul 5, 2020
    Posts:
    13
    I'm not looking for a curved UI. I have a flat UI and I want that to move to the center of the player camera view so it always facing them. I want to it to follow the horizontal view (looking left or right) of the user (looking up and down or rotating their head clockwise shouldn't move it). Rotating on the y axis so all parts are visible to them.
     
  4. Dark-Table

    Dark-Table

    Joined:
    Nov 25, 2008
    Posts:
    315
    Microsoft has an open source utility called Visual Profiler that does this nicely. It stays in front of the user but doesn't change pitch when you look up/down. You can probably learn from it's code:

    https://github.com/microsoft/VisualProfiler-Unity
     
  5. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Why don't you just make that UI a child of the camera?
    I always do this and it works sweetly.
     
  6. Josh65

    Josh65

    Joined:
    Jul 5, 2020
    Posts:
    13
    If I understand what your are saying that wont work as it will always be visible with out an extra script and it will follow them on all axis witch I don't want.
     
  7. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    So if you don't want to follow all the axis rotation, AND you don't want to add another script, the ONLY other solution is to add an extra empty object: the first object, let's call it A, will have your GUI on it, and will only rotate on the Y axis.
    Another object, let's call it B, will be child of A, and your camera will be there and rotating only on the X axis (I guess).
    With this configuration, the user will have the GUI at a fixed height in the scene, even when he is watching up or down.
     
  8. stutikafle

    stutikafle

    Joined:
    Sep 11, 2023
    Posts:
    7
    So did you find the solution??