Search Unity

Getting Gear VR Controller to detect a single touch

Discussion in 'AR/VR (XR) Discussion' started by shakozzz, May 3, 2017.

  1. shakozzz

    shakozzz

    Joined:
    Mar 1, 2017
    Posts:
    60
    Hi guys,
    I'm trying to get the touch pad on the Gear VR controller to behave like a joystick. In other words, I want it to detect when I simply touch somewhere on the touch pad, not necessarily drag, and give me the position of my touch. Using Input.GetAxis and Input.mousePosition I'm able to get some sort of feedback when I drag my finger across i.e. swipe, however merely touching does not do anything. Also Input.touchCount only returns a number greater than zero when I swipe not when I just touch. Is that simply how the Gear VR controller works in that it only detects clicks and swipes and not single touches or am I using the wrong functions to detect input? My ultimate goal is to move my player around using the controller's touch pad similar to a joystick.
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,546
    Using Unity's api for the Gear VR controller isn't very robust. It's essentially a holdover from when input was HMD only on the Gear VR. I don't believe Unity has plans to get the new Oculus API fed into their input API until the new input system is out which will be a long time.

    You should be using the Oculus utilities unitypackage from their website and use OVRInput.Axis2D.PrimaryTouchpad. You certainly can do what you describe with the Oculus API.

    Small plug for my asset that does this and more for Gear VR (there is a FPS example) down in my signature. If not interested though I'd be more than happy to answer any of your questions about their native API. I've been building higher level controls on top of it for awhile like dpads, laser pointers, etc. and continually adding more.
     
  3. shakozzz

    shakozzz

    Joined:
    Mar 1, 2017
    Posts:
    60
    Thanks for the tip. I ended up indeed using OVRInput and it does achieve what I want.
    I have a new question up on player controller rotation if you have time to check it out.
     
  4. vimevim

    vimevim

    Joined:
    Feb 17, 2019
    Posts:
    4
    I want to detect gestures like touching centre of the trackpad and swipe to the right edge and swiping from the left edge into the right edge through the center of the trackpad. How will i do that?
     
    ROBYER1 likes this.