Search Unity

Want both Vive and Oculus support in one app

Discussion in 'AR/VR (XR) Discussion' started by rickblacker, Jul 3, 2018.

  1. rickblacker

    rickblacker

    Joined:
    May 1, 2014
    Posts:
    266
    Hey all...

    I'm trying to find the path of least resistance in creating VR apps that support both Vive and Oculus. My needs are not all that much, just head tracking, basic controller input and teleportation.

    I tried VRTK and got it up and working with Vive. However, when I hooked up my Oculus, I was not getting any controller tracking at all in either my app or their sample apps.

    So, I'm looking for alternatives. I understand that SteamVR can support both Oculus and Vive. However, I read something to the effect that if you want Oculus support, you have to run the app from the Steam store? Is this true? I have no plans to post this up to any store.
     
  2. KingKRoecks

    KingKRoecks

    Joined:
    Jul 28, 2013
    Posts:
    155
    It's actually pretty easy to do with no downloadables.

    For tracking specific devices, Unity has their own XRNode definitions:
    UnityEngine.XR.XRNode.LeftHand
    UnityEngine.XR.XRNode.Head

    You then pass them into these static functions to get the position and orientation relative to the VR root position:
    UnityEngine.XR.InputTracking.GetLocalPosition
    UnityEngine.XR.InputTracking.GetLocalRotation

    As far as input itself, you can just reference the Open VR Controllers page to find out what joystick button each of the controller types maps to:
    https://docs.unity3d.com/Manual/OpenVRControllers.html

    Then you check it as you normally would with Input.GetButtonDown("RegisteredButtonName") and a registered input.
     
    JoeStrout likes this.
  3. rickblacker

    rickblacker

    Joined:
    May 1, 2014
    Posts:
    266
    Thanks KingK... I got VRTK up and working before I noticed you had replied. At some point I'd like to come back and check this out.