Search Unity

Check to see if Oculus Touch is being used.

Discussion in 'AR/VR (XR) Discussion' started by Mark-Paul, Mar 7, 2017.

  1. Mark-Paul

    Mark-Paul

    Joined:
    Feb 8, 2013
    Posts:
    46
    Hi All

    Our current menu system has a default setting of Xbox controller for our Oculus Rift game, but we want to be able to check if a touch is being used, and then switch to touch as default.

    Has anyone implemented this check who could point me in the right direction or lend a hand to a graphic artist with limited scripting knowledge :)

    Cheers

    Mark
     
  2. sfjohansson

    sfjohansson

    Joined:
    Mar 12, 2013
    Posts:
    369
    Checking the name of the controller should do the job:

    UnityEngine.Input.GetJoystickNames() as Oculus Touch - Left and Oculus Touch - Right, and the Oculus Remote appears as Oculus Remote.

    https://docs.unity3d.com/Manual/OculusControllers.html

    Hope it helps!

    /stefan
     
  3. yunhan0

    yunhan0

    Joined:
    Aug 18, 2016
    Posts:
    6
    You can check if the active controller is Oculus Touch

    OVRInput.Controller activeController = OVRInput.GetActiveController();
    if (activeController == OVRInput.Controller.Touch)
    {
    // do some stuff
    }
     
    Emiles and ThreeFourML like this.
  4. kavanavak

    kavanavak

    Joined:
    Sep 30, 2015
    Posts:
    54
    This would only tell you if BOTH controllers were active. GetActiveController returns LTouch if only Left is active, RTouch if only right controller, Touch if both and None if neither.
     
    mofvr likes this.