Search Unity

  1. New Unity Live Help updates. Check them out here!

    Dismiss Notice

Get VR room-scale bounds w/ native Unity

Discussion in 'AR/VR (XR) Discussion' started by plmx, May 14, 2019.

  1. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    257
    Hi,

    is there a way to get the currently set chaperone/guardian bounds (preferably in Unity units) from both SteamVR and Oculus using only native Unity code? Something in the XR namespace, maybe? I was not able to find it :-(

    Philip
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    5,960
    at least in steamvr there is SteamVR/Scripts/SteamVR_PlayArea.cs
    which seems to do some kind of mesh bounds from OpenVR.Chaperone.GetPlayAreaRect?

    havent tested that what it actually returns..
     
  3. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    257
    Both the SteamVR and the Oculus plugins support getting the play area size; however, my question was/is about getting said size using only Unity API.
     
  4. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    145
    I know we have access to it natively, but I don't see any developer APIs for it. I want to get that in for 2019.3, it really should be available without plugins.
     
    Gruguir, alexchesser and plmx like this.
  5. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    257
    Thanks for the honest answer, and it would be totally great to have that. I keep my fingers crossed, having it in 2019 would be perfect.
     
  6. MrNorel

    MrNorel

    Joined:
    Aug 6, 2019
    Posts:
    5
    Hi,
    Is there any update on this point ?
    It would be very helpful.
    best,
    Norel
     
  7. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    145
    ROBYER1 and hippocoder like this.
  8. Jakob

    Jakob

    Joined:
    Sep 29, 2011
    Posts:
    36
    Is there a example for this? And how to use it?
     
  9. MrNorel

    MrNorel

    Joined:
    Aug 6, 2019
    Posts:
    5
    Thanks a lot StayTalm !

    This is the way I managed to use this function :
    - Stopped using Legacy XR (Project Settings > Player > XR)
    - Started using XR Management package, as described here
    - Placed TrackedPoseDrivers on cameras since they are no longed added automatically
    - Used this code :
    Code (CSharp):
    1. List<InputDevice> inputDevices = new List<InputDevice>();
    2. InputDevices.GetDevicesWithRole(InputDeviceRole.Generic, inputDevices);
    3. InputDevice hMDDevice = inputDevices[0];
    4. XRInputSubsystem XRIS = hMDDevice.subsystem;
    5. List<Vector3> boundaryPoints = new List<Vector3>();
    6. XRIS.TryGetBoundaryPoints(boundaryPoints);
    And I get access to my Guardian boudaries, without using OVRManager, which is great.

    However, in the headset, the image is only displayed on left eye (right eye is blue). I couldn't manage to fix it, even by using Single Pass Rendering.
    The display also seems significatively slower than before.
    Any hints on how I could solve this ?

    I'm using an Oculus Rift S on Windows, with Unity 2019.3.0f1, and rendering with Universal RP.

    Best,
    Norel
     
  10. ian_unity431

    ian_unity431

    Joined:
    Oct 12, 2018
    Posts:
    10
    I found that in 2019.3.0f5 I had to use the "3D" pipeline. When I used Universal RP with the XR Managment system, it only rendered in the left eye of my Oculus Quest. From what I could find, it seems like the Universal RP isn't quite ready yet for VR development.

    Bonus: check out the XR Managment Example repo Unity is developing. you might find it useful.
    https://github.com/Unity-Technologies/XR-Interaction-Toolkit-Examples
     
  11. alexchesser

    alexchesser

    Joined:
    Sep 15, 2017
    Posts:
    129
    Confirmed. the One-eye bug is in URP 7.1.8 and will be fixed in 7.2.0 which was supposed to release two days ago, but they had a regression in QA so it'll probably be out next week sometime.
     
  12. Henrikplayer

    Henrikplayer

    Joined:
    Jun 23, 2013
    Posts:
    1
    Is there a way to get this to work with Oculus Quest via Link Cable (or Wireless via Virtual Desktop).
    I am trying to make a large roomscale application.
    The Quast Guardian System is always correct. But each Time i start the Experience the Player gets a random Position and Rotation. So I want to use the Guarding System as referenz to Calibrate the Player. But when I try to get the Boundarypoints the List is always empty.
     
    throzen likes this.
  13. throzen

    throzen

    Joined:
    Jun 11, 2015
    Posts:
    6
    I have the same Problem. Also Quest, always getting an empty list. I detailed it in another thread, so I'm posting here too so both threads are cross linked, just in case ^^
    (https://forum.unity.com/threads/can-we-reuse-user-s-vr-boundaries.818331/#post-5558206)

    In your case, have you tried it with the "XRInputSubsystem.TryRecenter" after your application starts?
     
  14. miik2

    miik2

    Joined:
    Aug 23, 2018
    Posts:
    5
    hey guys, you can fix your rendering prob with updating the ur pipeline to 7.2.1 - that works for me. But unfortunately I didn´t get the boundary points, list is always empty. Do you have any suggestions?
     
  15. koniouchine

    koniouchine

    Joined:
    Mar 3, 2018
    Posts:
    5
    I had success with the following method
    Code (CSharp):
    1. public GameObject wallMarker;
    2. //Check if the boundary is configured
    3. bool configured = OVRManager.boundary.GetConfigured();
    4.         if (configured)
    5.         {
    6.             //Grab all the boundary points. Setting BoundaryType to OuterBoundary is necessary
    7.             Vector3[] boundaryPoints = OVRManager.boundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary);
    8.        
    9.              //Generate a bunch of tall thin cubes to mark the outline
    10.             foreach (Vector3 pos in boundaryPoints)
    11.             {      
    12.                 Instantiate(wallMarker, pos, Quaternion.identity);
    13.             }
    14.         }
    Edit: This will obviously only work for Oculus
     
    Last edited: Mar 26, 2020
unityunity