Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity wants to learn about your experiences working on a Unity project today. We'd like to hear from you via this survey.
    Dismiss Notice
  3. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  4. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  5. Read here for Unity's latest plans on OpenXR.
    Dismiss Notice

Can we reuse user`s VR boundaries?

Discussion in 'AR/VR (XR) Discussion' started by humansteak, Jan 29, 2020.

  1. humansteak

    humansteak

    Joined:
    Feb 4, 2016
    Posts:
    35
    Hi!

    I would like to know if we can (and how :) ?) reuse the VR boundaries our VR user has to define before starting playing ?
    So the Guardian for Quest users, and the play area for SteamVR users etc.

    Ideally I would reuse these so my users don`t have to make a new one for my application...

    What I`m looking for is like a flat geometry, or a curve? Or points and index so I can then generate something out of it..?

    Also if anyone has reference of like other games/apps doing so I`d appreciate !

    Thanks
     
    JoeStrout likes this.
  2. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    158
  3. humansteak

    humansteak

    Joined:
    Feb 4, 2016
    Posts:
    35
    Thank you this will come in very practical when its time comes ! :)
     
  4. humansteak

    humansteak

    Joined:
    Feb 4, 2016
    Posts:
    35
    Do you have a tool in mind when it comes to procedurally model an environment depending on the Boundary Points?
    I can think of Houdini but this won't be available at runtime.
    Spline driven models that would use the Boundary points could get pretty advanced quickly, but I want to gain immersion by having some more variations on the wall so either edit this pline, either on the non reach-able parts (high building with different roofs setups etc.) To be short I'd like more than splined models. Tryin
    I know a bit of Bolt I could try this in there, would you have anything easier in mind for achieving this or similar ?
     
  5. hawken

    hawken

    Joined:
    Aug 22, 2013
    Posts:
    574
    Wow! Does this work with Oculus / Quest as is?
     
  6. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    158
    Yes!
    But only in the new Plugin Architecture packages, Oculus was implemented in V1.0.0 of the package.
     
  7. Enzo-z1

    Enzo-z1

    Joined:
    Jan 28, 2019
    Posts:
    2
    Hello guys !

    I've been looking for a while after a solution for this.
    I tried your method @StayTalm_Unity but i don't understand something. TryGetBoundaryPoints is a bool method, wich not send back any Vector3 stuff.

    I also tried this method (and also lots of desperate things as retrieving the points directly from the Boundary Rendering gameobject) :

    if (OVRManager.boundary.GetConfigured())
    {
    Vector3[] boundaryPosition = OVRManager.boundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary);
    }

    But it keeps returning an empty array. I searched in the OVRBoundary code and don't get oculus devs logic.

    If someone has some code to leak... ^^ it would help me!

    If I further don't find a solution, I will try to change versions of oculus integration/packages/plugins/whatever..
     
  8. throzen

    throzen

    Joined:
    Jun 11, 2015
    Posts:
    6
    Hey. I was trying the new API with Oculus Quest (mostly with Oculus Link, but I tested without Link as well),
    and this function does not return any poits at all for me.
    Since the API is new and I just started using it over the old OculusIntegration etc., I assume I'm missing something on my end.
    What I'm trying is this:

    Code (CSharp):
    1.     public void get_boundary_vertices()
    2.     {
    3.         List<XRInputSubsystem> subsystems = new List<XRInputSubsystem>();
    4.         SubsystemManager.GetInstances<XRInputSubsystem>(subsystems);
    5.  
    6.         // make sure I actually have a subsystem loaded
    7.         if (subsystems.Count > 0)
    8.         {
    9.             // create a List of Vec3 that will be filled with the vertices
    10.             List<Vector3> boundaryPoints = new List<Vector3>();
    11.  
    12.             // if this returns true, then the subsystems supports a boundary and it should have filled our list with them
    13.             if (subsystems[0].TryGetBoundaryPoints(boundaryPoints))
    14.             {
    15.                 foreach (Vector3 pos in boundaryPoints)
    16.                 {
    17.                     // TODO: do something sensible with the points, not this
    18.                     Instantiate(GameObject.CreatePrimitive(PrimitiveType.Cube), pos, Quaternion.identity);
    19.                 }
    20.             }
    21.         }
    22.     }
    Since I'm chipping in here you might suspect: it does not work ^^ The TryGetBoundaryPoints function returns true, but the list remains empty.
    - The subsystems seems loaded correctly ( when stepping through I do get an "oculus input")
    - it does not matter whether oculus Link is used or not
    - I've tried it with stationary boundary as well as a roomscale boundary setup
    - I thought maybe I need to call Start on the subsystem manually, but that did not do the trick
    - I am using the default 3D pipeline atm
    - other calls to the subsystem (i.e.GetTrackingOriginMode and GetSupportedTrackingOriginModes) return as expected

    I might be missing something obvious, but so far this has brought me no luck.
    The docs are sparse, in classic Unity fashion. ^^ The parameter is not explicitely declared and out param nor ref, so I'm not even sure this is how it is meant to work at this point!?

    I saw another user 'MrNorel' in another forum thread say it worked for him with a slightly other way of getting to the subsystem, but trying that made no difference.
    (this thread: https://forum.unity.com/threads/get-vr-room-scale-bounds-w-native-unity.678289/#post-5366235)

    If anyone has a working version or can tell me where I am going wrong, I would appreciate it :)
     
    Last edited: Mar 6, 2020
    JoeStrout likes this.
  9. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    158
    @Enzo-z1 The bool that it returns, returns whether or not boundary points were successfully retrieved. This is important because there could be 0 points, but it can still have successfully got those 0 points, compared to some kind of internal failure to get points at all. The second benefit to this 'return value stating if function was a success, return data as paramters' pattern is that it can help you avoid heap allocations. You can reuse the same List and avoid creating new memory that needs to be almost immediately cleaned up because you specify which list to fill with data. If we returned a list, we couldn't let you supply a location in memory to put the boundary data.

    That function expects a List<Vector3> to be passed in. That list gets filled with boundary points. So you would use it somewhat like this:
    Code (CSharp):
    1. List<XRInputSubsystem> inputSubsystems = new List<XRInputSubsystem>();
    2. SubsystemManager.GetInstances<XRInputSubsystem>(inputSubsystems);
    3. if(inputSubsystems.Count > 0)
    4. {
    5.     List<Vector3> boundary = new List<Vector3>();
    6.     if(inputSubsystems[0].TryGetBoundaryPoints(boundary))
    7.     {
    8.         // boundary is now filled with the current sequence of boundary points
    9.     }
    10. }
     
  10. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,215
    @StayTalm_Unity This doesn't appear to work at all with Quest + 2019.3.3 + v14 + XRPluginManagement/OculusLoader

    I get one XRInputSubsystem (not much info on that object to debug, but I see it's reporting "Floor" mode, as expected), but zero points. I stuck it in Update to isolate any issues with startup/callbacks, and I just get neverendign "Nope, ther'es no boudnary", even when I can see it right in front of me :).
     
  11. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,215
    PS: I dislike the "if( success )" approach to API coding. It gives you no information about what the succes / failure was. If that's going to be in the final release, please could we upgrade to API's with a signature more like:

    Code (CSharp):
    1. void TryThing( List preAllocList, out ErrorObjectOrNull );
    ...or go with the C# practice of throwing an exception on failure. Debugging in the presence of core methods that are returning "false" is a nightmare, especailly on larger projects.
     
  12. miik2

    miik2

    Joined:
    Aug 23, 2018
    Posts:
    5
    This also doesn´t work for me. I work also with Quest, 2019.3.0f6 and the XRPlugin Managment System. I get an empty list .. Do you have any suggestions or is this a known issue?
     
  13. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,215
    I guess: file a bug, with an empty project that has just one class that demonstrates the problem.

    As far as I can tell, we're doing it right, it's just not working :)
     
  14. koniouchine

    koniouchine

    Joined:
    Mar 3, 2018
    Posts:
    5
    I read a bunch of posts and eventually pieced together the following solution.
    Now I can create an outline of my outer boundary using a some primitives.


    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.         }
    Now I just need to figure out how to position the play area so that the created boundary is positioned correctly relative to the starting position of the player.
    If anyone knows how to do that. Feel free to post it.

    Edit: This is using Unity 2019.3.0f1 and building directly to a Quest
     
    glenneroo likes this.
  15. a436t4ataf

    a436t4ataf

    Joined:
    May 19, 2013
    Posts:
    1,215
    That's using a different API though, and will only work for one headset / manufacturer, right?

    i.e. it's not using the universal, cross-platform, API that most of us in this thread were trying to get working (which should work on all headest, from all manufacturers. In theory)
     
  16. koniouchine

    koniouchine

    Joined:
    Mar 3, 2018
    Posts:
    5
    Fair enough

    When I was reading this I was thinking about building to Oculus, so I must have missed the part where this thread was supposed to be device agnostic.
     
  17. fherbst

    fherbst

    Joined:
    Jun 24, 2012
    Posts:
    746
    @StayTalm_Unity same here, no points returned at all with TryGetBoundaryPoints. One subsystem found.
    Unity 2019.3.10f1, XR Plugin Management 3.2.9, Oculus XR Plugin 1.3.3. Oculus Rift S as well as Quest+Link.

    The "old" way of Oculus also does not return any points.
     
  18. humansteak

    humansteak

    Joined:
    Feb 4, 2016
    Posts:
    35
    Hello! Does anyone know and is willing to explain how to convert these data from above posts to a Unity Spline ?
    Thanks ! :)
     
  19. stevendimmerse

    stevendimmerse

    Joined:
    Aug 7, 2018
    Posts:
    7
    Having the same issue have to build for the quest every time to test, no boundary data with the quest in link mode
     
  20. Fingerbob

    Fingerbob

    Joined:
    Sep 6, 2014
    Posts:
    18
    Same issue - 2019.3.13f1, XR Plugin Management 3.2.10, Oculus XR plugin 1.3.4.
    no points returned (list count is zero). return value is true (indicating success). XR input subsystem is running. I've also tried polling it every second for the next minute (to see if it kicks into life) - no joy. Nothing fires the boundary changed callback.
     
  21. masai2k

    masai2k

    Joined:
    Mar 2, 2013
    Posts:
    20
    I have the same problem, any news??
     
  22. Greg-Bassett

    Greg-Bassett

    Joined:
    Jul 28, 2009
    Posts:
    623
    Same here, no point data, any news?
     
  23. abszisse

    abszisse

    Joined:
    Jul 10, 2019
    Posts:
    1
    Same here. I tried using OVRPlugin.GetBoundaryGeometry2 directly and the portable TryGetBoundaryPoints on Quest. Both sometimes return a list of points or zero points randomly. Since The OVRPlugin is used by Unity behind the XR API internally, I guess this is a problem in the OVRPlugin :-(
     
  24. JPMcWhiskers

    JPMcWhiskers

    Joined:
    Sep 22, 2014
    Posts:
    7
    Hey so, I think most people are having trouble getting boundary points from the quest when debugging with Link enabled. This is frustrating, but there is a bit of a long winded work around.

    You can run the application without link and (go to untrusted sources in the Quest UI and run your application whilst not debugging in Unity), then "TryGetBoundaryPoints" and all of the related methods will work. You can "simply" log the point array to debug and then logcat your device through adb (./adb logcat -s Unity in powershell) and then use the points in your app.

    Where I'm kind of falling down is that my position in relation to those points seems to change when I'm debugging in relation to the boundary I've drawn on the quest. Can someone tell me how I can set the player orientation and position while debugging in Unity so that my copied boundary points will coincide with my current player position?
     
unityunity