Search Unity

Oculus Quest / UnityEngine.XR

Discussion in 'AR/VR (XR) Discussion' started by FL53, May 13, 2019.

  1. FL53

    FL53

    Joined:
    Nov 28, 2018
    Posts:
    14
    Hi,

    I was wondering if we could already develop for Oculus Quest using UnityEngine.XR ? It should be really convenient !
    Regards
     
  2. FL53

    FL53

    Joined:
    Nov 28, 2018
    Posts:
    14
    Seems XR is working to get tracking data but for controller buttons it does not match the XR Input specifications for Oculus (with 2018.2 it seems we should use InputDevice now to get events on controllers, I will try that)
     
    Last edited: May 23, 2019
  3. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Did you ever get the oculus input mapping to work on Quest with UnityEngine.XR ? Facing the same issue here...
     
  4. StayTalm_Unity

    StayTalm_Unity

    Unity Technologies

    Joined:
    May 3, 2017
    Posts:
    182
    Talking within our team, our understanding was that the buttons all worked and are mapped identically with the rift. The exception that the thumbrest does not exist.

    File a bug with us and we can try to figure out what's wrong.
     
  5. FL53

    FL53

    Joined:
    Nov 28, 2018
    Posts:
    14
    You should use Unity 2019.1 (at least) to have the button/axis mapping available on Quest (tracking is OK on 2018.3 but buttons/axis are not available)
     
  6. unisip

    unisip

    Joined:
    Sep 15, 2010
    Posts:
    340
    Any chance of this being back ported to 2018.4 ?
     
    joelybahh likes this.
  7. rwanim8or

    rwanim8or

    Joined:
    Jan 22, 2017
    Posts:
    18
    I'm on 2018.3 and buttons / axis are working just fine as well as tracking
     
  8. FL53

    FL53

    Joined:
    Nov 28, 2018
    Posts:
    14
    I may have tested too early (too old Unity 2018.3 release ? :) ).
    You can easily check button ID/availability (in any release of Unity) creating a text UI (in front of the user in world space putting the canvas child of the camera) to display the values of the buttons. Loop on all the joystick buttons (from 0 to 19) using Input.GetKey("joystick button "+ i ) with "i" your loop counter to retrieve the values of the buttons (to display them next in your text UI). You will only have to press your controller buttons to see if something changes on your UI. Hope it helps.
     
    Taran3D likes this.
  9. R1PFake

    R1PFake

    Joined:
    Aug 7, 2015
    Posts:
    542
    Did anyone get XR to work with the Quest? Im using Unity 2019 and my tracking position seems off, the (ingame) headset is at the floor (0,0,0) instead of the correct height. Does the Quest not return the correct floor/head height to the XR classes or am I missing something/doing it wrong? Btw the same scene worked fine for PC with Vive.
     
  10. FL53

    FL53

    Joined:
    Nov 28, 2018
    Posts:
    14
    You can ask your experience to be "roomscale" in XRDevice class (SetTrackingSpaceType)
     
    R1PFake likes this.
  11. R1PFake

    R1PFake

    Joined:
    Aug 7, 2015
    Posts:
    542
    This worked, thanks! In my opinion the tracking setting for the Quest should default to room scale like the Vive.
     
  12. VirtualPierogi

    VirtualPierogi

    Joined:
    Sep 3, 2012
    Posts:
    54
    Unity 2019.2 here, after porting to oculus quest my steamvr rig, hand controllers seem to switch from tracking to frozen state after touching any button : at first only right controller tracks movement but after I click a trigger on the left right freezes in place and left moves.
    Is there a possibility that it treats the quest as daydream or gearvr and just switches handedness controller?
     
  13. Ehredt

    Ehredt

    Joined:
    Jun 20, 2018
    Posts:
    79
    They added Go emulation to the Quest, which causes only one controller to work at a time -- this might be the problem you're describing: https://www.reddit.com/r/oculus/comments/cjarm3/unity_development_on_oculus_quest_only_one/
     
    VirtualPierogi likes this.
  14. SpeakBeaver

    SpeakBeaver

    Joined:
    Jul 8, 2015
    Posts:
    6
    Work perfectlty for me !!! Thanks a lot
     
  15. PMC0919

    PMC0919

    Joined:
    Sep 8, 2019
    Posts:
    13
    Hi. Would someone be able to paste the code for the room scale setting please? I am not good at scripting. I use Unity to work on my Sketchup files. I have built the scene for Android and loaded it to the Quest, but the camera is on the floor!
     
  16. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    void Start()
    {
    UnityEngine.XR.XRDevice.SetTrackingSpaceType(UnityEngine.XR.TrackingSpaceType.Roomscale);

    }
     
    pmcclave likes this.
  17. pmcclave

    pmcclave

    Joined:
    Nov 2, 2015
    Posts:
    10
    Thank you ROBYER1.
     
  18. PMC0919

    PMC0919

    Joined:
    Sep 8, 2019
    Posts:
    13
    Hi ROBYER1. I tried the code you suggested. I didn’t get any error messages but my scene in Unity when viewed on the Quest still has the camera sitting at the floor.
    It starts high and drops straight away. Do you work with Oculus Quest and Unity and could suggest what I could do to keep the camera at the correct height?
     
  19. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I need to see your scene setup, is there a rigidbody attached with gravity influencing it at all? Do you have the unity Tracked pose device component on your camera? You will need that with it set to tracking 'center eye'
     
  20. PMC0919

    PMC0919

    Joined:
    Sep 8, 2019
    Posts:
    13
    Hi ROBYER1. Thank you for you latest suggestion of adding the Tracked Pose device to the camera. I have finally got the camera to stay at the correct height. But the movement is now from me moving the Quest headset forwards!! Which as you can imagine nearly made me sick! Ha ha. Is there an easy way to change the movement so the joystick controls the movement? Sorry to keep pestering you!
     
    ROBYER1 likes this.
  21. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    It's fine, message me about it anytime. You've probably already figured it out but set the tracked pose device to be rotation only.
     
  22. methusalah999

    methusalah999

    Joined:
    May 22, 2017
    Posts:
    643
    This is now deprecated in 2021.1 apparently. I've been able to get to the same result with this:
    Code (CSharp):
    1. XRGeneralSettings.Instance.Manager.activeLoader.GetLoadedSubsystem<XRInputSubsystem>().TrySetTrackingOriginMode(TrackingOriginModeFlags.Floor);
    I'm sur there is a better/shorter/documented way.