Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

OVRInput.GetUp not working correctly in Unity 2017.2 with GearVR Controller

So, I seem to have encountered an issue in Unity 2017.2 with Oculus Utilities v 1.18.1. Calling OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger) does not return true when releasing the trigger on a GearVR Controller. I wrote the following code to test this:
void Update () {
  if (OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger))
        {
            r1.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.PrimaryIndexTrigger))
        {
            r1.material.color = Color.white;
        }
        if (OVRInput.GetDown(OVRInput.Button.PrimaryTouchpad))
        {
            r2.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.PrimaryTouchpad))
        {
            r2.material.color = Color.white;
        }
        if (OVRInput.GetDown(OVRInput.Button.Back))
        {
            r3.material.color = Color.red;
        }
        if (OVRInput.GetUp(OVRInput.Button.Back))
        {
            r3.material.color = Color.white;
        }
    }
The Primary Touchpad and Back button work appropriately when the GetUp and GetDown functions are called, and GetDown works with the Trigger, but GetUp is just not working. I tried this same code in 2017.1 and it works fine.

Comments

  • RohirmRohirm Posts: 6
    NerveGear
    edited October 2017
    I have same problem with GetDown, it doesn't work. Using Oculus Touch controllers with Unity 2017.1.1f1 and Oculus Utilities 1.18.1.

    Edit. Nevermind, the problem was after importing project to newer Unity the Touch controller bind was missing from the hands.
  • mannixlomannixlo Posts: 2
    NerveGear
    I got the same problem on OVRInput.GetDown(OVRInput.Button.Back) after I upgrade my project from Unity 2017.1.1f1 to 2017.2.0f3. Most of the time it doesn't work. i.e. It works randomly.
  • ichitakaichitaka Posts: 2
    NerveGear
    Just started my first project and i'm encountering the same problem. OVRInput.Get does work flawlessly, so the Controller and Button i'm trying to utilize are working correctly.

    My OVRInput.GetDown(OVRInput.Button.PrimaryIndexTrigger) (GetUp too) does not return true. When i build the GearVrControllerTest Scene from the SDK and test the controller, i'm not getting a true from the controller on Down either. true at the Button itself and a *False* instead of a False at the Down parameters. 
  • MohamedElmazenMohamedElmazen Posts: 13
    NerveGear
    edited October 2017
    if your unity is 2017.2.0f3 

    try this

    edit OVRInput.cs  inside Update

    Change:

            // Promote TrackedRemote to Active if one is connected and no other controller is active
    if (activeControllerType == Controller.None)
    {
                if ((connectedControllerTypes & Controller.RTrackedRemote) != 0)
                {
                    activeControllerType = Controller.RTrackedRemote;
                }
                else if ((connectedControllerTypes & Controller.LTrackedRemote) != 0)
                {
                    activeControllerType = Controller.LTrackedRemote;
                }
    }

    To:

            // Promote TrackedRemote to Active if one is connected and no other controller is active
    if (activeControllerType > 0)
    {
                if ((connectedControllerTypes & Controller.RTrackedRemote) != 0)
                {
                    activeControllerType = Controller.RTrackedRemote;
                }
                else if ((connectedControllerTypes & Controller.LTrackedRemote) != 0)
                {
                    activeControllerType = Controller.LTrackedRemote;
                }
    }

    i change activeControllerType  from Controller.None to activeControllerType  > 0
    because we have already an Active Controller but it register to system only when i press trigger Button,
    so with my edit we can force system to register the Controller , now I just test OVRInput.GetDown & GetUp its work fine.

    hope it help
  • JamokeJamoke Posts: 9 Oculus Start Member
    This did not solve the problem for me.  I think this issue is rooted in something else.   One thing I noticed while testing through things in 2017.2 is that when I press the Trigger button on the GearVR Controller, it actually says my active controller is a Gamepad, not an LTrackedRemote.   I was able to get a LOT of anomalous output in 2017.2 that wasn't there in 2017.1.   

    Other Mobile VR Frameowkrs have stated that there are some problems on Unity's XR Input side that were introduced in 2017.2 (b11, and f3).  These issues have been confirmed by Unity's staff, and slated for the next patch release of Unity.   Might be worth waiting till 2017.2.0p1 to see if some of this is ironed out Unity's Engine side.
  • 80dots80dots Posts: 5
    NerveGear
    I have same issue.
    Back key is NOT work.

    I wish to fix this problem ASAP...
  • 80dots80dots Posts: 5
    NerveGear
    edited November 2017
    @imperativity

    1. Make new Unity project. (I used Unity3D 2017.2)
    2. Import OVR Utility (I used 1.19.0 version.)
    3. Restart Unity Project.
    4. Write the below code. I just show the status of key at UGUI.

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    
    public class ShowBackKeyStatus : MonoBehaviour {
    
        public Text Status_DownUp;
        public Text Status_Pressing;
        public Text Status_Touchpad_Pressing;
    
        // Use this for initialization
        void Start ()
        {
            Status_DownUp.text = "Back key Released";        
        }
    	
    	// Update is called once per frame
    	void Update ()
        {
    
            //In case of the below code, Back key is NOT work.
            bool isPressBackKey = OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);
            bool isReleaseBackKey = OVRInput.GetUp(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);
            bool isPressingBackKey = OVRInput.Get(OVRInput.Button.Back, OVRInput.Controller.LTrackedRemote) || OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.RTrackedRemote);
    
            //In case of the below code, Back key works
            //bool isPressBackKey = OVRInput.GetDown(OVRInput.Button.Back, OVRInput.Controller.Active);
            //bool isReleaseBackKey = OVRInput.GetUp(OVRInput.Button.Back, OVRInput.Controller.Active);
            //bool isPressingBackKey = OVRInput.Get(OVRInput.Button.Back, OVRInput.Controller.Active);
            
            //Touchpad is work even if it's same code with Back key.
            bool isPressingTouchpad = OVRInput.Get(OVRInput.Button.PrimaryTouchpad, OVRInput.Controller.LTrackedRemote) || OVRInput.Get(OVRInput.Button.PrimaryTouchpad, OVRInput.Controller.RTrackedRemote);
    
            if (isPressBackKey)
            {
                Status_DownUp.text = "Back key Pressed";
                isReleaseBackKey = false;
            }
            else if(isReleaseBackKey)
            {
                Status_DownUp.text = "Back key Released";
                isPressBackKey = false;
            }
    
            Status_Pressing.text = string.Format("Back key Pressing : {0}", isPressingBackKey.ToString());
    
            Status_Touchpad_Pressing.text = string.Format("Touchpad Pressing : {0}", isPressingTouchpad.ToString());
        }
    }
    
    


  • LivingValkyrieLivingValkyrie Posts: 4
    NerveGear
    im also having this issue, glad to know that theres a ticket open for it. ive tried all builds from 1.16 and up ALL with 4 different unity builds and every combination fails, its really putting a strain on my project. ive developed a really crappy workaround, but its no substitute 
  • NilmagNilmag Posts: 2
    NerveGear
    @80dots

    We have an internal task open to fix this issue at this time. Thanks for the additional repro steps.
    Can you please reply to this thread when you've created the working build?

    Thanks for your efforts in getting this issue resolved. Also if i wanted to HOLD down the trigger key, what code would i need to use for that? I'd test it myself but as you already know it's not working.
  • NilmagNilmag Posts: 2
    NerveGear
    edited November 2017
    It's ok im using left mouse click for the meantime, which means all keys do the same thing but for simple testing its manageable.

    Your ongoing efforts are always appreciated.
  • TrevJTTrevJT Posts: 44
    Brain Burst
    @MohamedElmazen Thanks that totally worked for me! Unity v2017.2.0b7, Oculus Utilities v1.18.1

    T
  • maessofmaessof Posts: 1
    NerveGear
    1.21 update seems to not have fixed it on v2017.3, well thats my setup.
  • psych7psych7 Posts: 1
    NerveGear
    Unity 2017.3 here,  and this is still not working for me... Any news on this?
  • chorst2017chorst2017 Posts: 1
    NerveGear
    lmao 3 months and their input system still doesn't work?!
  • jobesujobesu Posts: 3
    NerveGear
    edited February 2018
    Modifiying the line 310 of OVRInput from:
    RawButton rawButtonMask = RawButton.Any & ~RawButton.Back;
    to
    RawButton rawButtonMask = RawButton.Any; // & ~RawButton.Back;

    Seems to fix the bug "back button not responsive if player didn't touch the touchpad first" on Unity 5.6.5p1 with SDK 1.22 and 1.23. No idea about possible side effects of this though.
  • danielfaustinobsdanielfaustinobs Posts: 6
    NerveGear
    jobesu said:
    Modifiying the line 310 of OVRInput from:
    RawButton rawButtonMask = RawButton.Any & ~RawButton.Back;
    to
    RawButton rawButtonMask = RawButton.Any; // & ~RawButton.Back;

    Seems to fix the bug "back button not responsive if player didn't touch the touchpad first" on Unity 5.6.5p1 with SDK 1.22 and 1.23. No idea about possible side effects of this though.
    Yeah, I've done the same thing but I'm wondering about the side effects. Outcome of some "research" on my side here:
    https://forums.oculusvr.com/developer/discussion/61093/gearvr-back-button-not-being-detected-by-ovrinput-oculus-utilities-1-21/
  • DHARMAKAYADHARMAKAYA Posts: 52
    Hiro Protagonist
    edited March 2018
    Glad I saw this topic on google search by chance...sorta FURIOUS right now because I was doing multiple builds trying to get a script functioning that uses GetUp...sadly not surprised that oculus screwed up on Gear VR again...the minuscule amount of scripts for Gear VR that have been provided don't function properly...it is simply amazing how RIDICULOUSLY INEPT that makes oculus, facebook, and samsung seem to be...ESPECIALLY considering the companies supposedly have BILLIONS OF DOLLARS and THOUSANDS OF EMPLOYEES...a skilled team of one could write these properly. A skilled team of 5 should be plenty to write them AND verify that everything works on each iteration of Unity. Imagine there is a team of 50 or more and yet...
  • DHARMAKAYADHARMAKAYA Posts: 52
    Hiro Protagonist
    edited March 2018
    lmao 3 months and their input system still doesn't work?!
    High five. Proof that BILLIONS OF DOLLARS and thousands of employees alone can't make high quality, reliable products. 
    If only a VC had invested in the HMD that I designed and made a functional prototype of SOLO.  

    Now to go write a grab script because it seems doubtful that the oculus grab script has been made functional yet. 
  • florianwirth_KITflorianwirth_KIT Posts: 1
    NerveGear
    Is there any news about that issue? I seem to have the same and updating unity (to 2018.2.0f2) doesnt help. Sometimes I can access the button signals, sometimes I can't. The only thing I can reliable access is position and rotation. surprisingly, I can see on which button my fingers are currently lying. but when I press that button I can neither see the button beeing pushed, nor is there a change in the variables that I try to read out within my code.
  • rustableantrustableant Posts: 5 Oculus Start Member
    @mannixlo

    Were you able to fix the issue?
  • rustableantrustableant Posts: 5 Oculus Start Member
    To anyone looking into this, the issue seems fixed with oculus utilities 1.28
  • TrevorSunTrevorSun Posts: 9
    NerveGear
    edited November 2018
    Team
    I have the same issue, OVRInput.get works, but getdown getup not.
    My version as
    Current version: 1.30.0
    Bundled version : 1.29.0
    My app is running on Windows,  and my Unity version as 2018.2.14f1

    Can i confirm if someone have the issue fixed?
  • cenek.strichelcenek.strichel Posts: 8 Oculus Start Member
    edited January 24
    Hello I am using the latest Oculus integration and OVRInput.Button.Back on the Oculus Go works very randomly. Any tips?
Sign In or Register to comment.