Search Unity

Using GearVR's built-in Dpad to control? (Me Noob)

Discussion in 'AR/VR (XR) Discussion' started by saidthebird, Mar 25, 2017.

  1. saidthebird

    saidthebird

    Joined:
    Mar 25, 2017
    Posts:
    3
    Hello, I am relatively to new unity as well as scripting. I just purchased my GearVr and I wish to use it for the game. I'v searched some tutorials on youtube and I came across this channel,


    However, he uses GoogleVR SDK, but I followed nonetheless. Now, I wish to use the Dpad to move around my character, but I don't know how. I've downloaded Occulus SDK and installed it, (I think). Then I looked up in the OVRInput documentation.
    However, OVRInput.GetDown(OVRInput.Button.DpadDown); doesn't seems to work? I don't even know if this is the right one... seems like it does, I have no idea...

    All I've accomplished was
    if (Input.GetButtonDown("Fire1"))
    {
    //Change the state of Moveforward
    moveForward = !moveForward;
    }
    Something like this... that's my level of programming:( That's how noob I am on this... Can someone please help me? I really really need to do this and quick!
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
    Thanks for checking out my videos! There's a lot of problems when moving a player in VR with a controller. For example does the stick turn the players head? Because this is not a good design for VR. Best solution I think is only using 1 stick, forward and backwards moves player in those directions and left and right STRAFES the player. Check out part 1 and part of my Bluetooth videos and theres MANY discussions and solutions in the comments too.


    I also have a basic bluetooth example in my movement pack:
    https://www.assetstore.unity3d.com/en/#!/content/69041
     
  3. saidthebird

    saidthebird

    Joined:
    Mar 25, 2017
    Posts:
    3
    wow! thanks man, but I'm not using a controller though. I want to accomplish it by just using a Samsung gear vr headset. On the sides, it seems to have touch sensors that looks strikingly like a d-pad buttons. All I want it is just to use swipe functions... such as swipe right to attack and etc etc... I've read the documentations on Oculus Dev, but OVRInput doesn't seems to work?

    I would love to get more insight on using the built-in buttons of Gear VR. Right now, all I can do is just tap, like the code I've shown above.
     
  4. MCSilver

    MCSilver

    Joined:
    Apr 6, 2017
    Posts:
    4
    Hello,

    i have currently the same Issue.
    Basically following this:
    https://developer3.oculus.com/documentation/game-engines/latest/concepts/unity-tutorial/
    https://developer3.oculus.com/documentation/game-engines/latest/concepts/unity-ovrinput/

    Code (CSharp):
    1.         if (OVRInput.Get (OVRInput.RawButton.DpadUp)) {
    2.             input.text = "Up";
    3.         }
    4.  
    5.         if (OVRInput.Get (OVRInput.Button.DpadUp)) {
    6.             input.text = "Up";
    7.         }
    The Inputmanager from Unity itself had new entries like:
    Code (CSharp):
    1. Input.GetAxis ("Oculus_GearVR_DpadX"); Input.GetAxis ("Oculus_GearVR_DpadY"); //5th & 6th Axis
    But nothings seems to work, my guess that the documentation is not really complete ... maybe some detail is missing in the docs. Well i have to figure it out anyway but maybe someone with more Expierence can help?

    The DPad itself works on Menu and Stuff... so no Hardware Issue :D
    .....

    But maybe its smarter to get first knowledge about debugging and testing before starting, it goes already on my nerve to unplug and plugin the Handy Device every single time.
     
  5. MCSilver

    MCSilver

    Joined:
    Apr 6, 2017
    Posts:
    4
    Okay i dont know why these OVRInput things not working. But i never would have guessed that this DPad is considered as a Touchpad :D

    So basically the controls can be tested with mouse movement.

    Code (CSharp):
    1.      
    2. float moveHorizontal = Input.GetAxis ("Mouse X");
    3. float moveVertical = Input.GetAxis ("Mouse Y");
    4.  
    5. //Default Mouse Left Click
    6. Input.GetButton ("Fire1")
    7.  
    Well what could be done with this, some Drag&Drop Mechanics... i would guess mostly slow Movements, ... where you sitting on a desk. and craft something... maybe.

    @saidthebird
    I hope you get a little bit further with this information but if you are really a starter in programming, maybe you should train these skills first or get a general understanding of unity.

    Edit:

    Prolly important too:
    https://developer3.oculus.com/blog/unitys-ui-system-in-vr/

    i guess thats why OVRInput is not working... :rolleyes:
     
    Last edited: Apr 7, 2017
  6. fseydel

    fseydel

    Joined:
    Jan 23, 2014
    Posts:
    5
    Easy explanation: Make sure that OVRInput.Update() is called regularly.
     
  7. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    Selzier, do you have tips on bluetooth controllers that actually WORK on an android phone ? I tried with the cheap vr box controllers from ebay( nothing) and then with a ps3 controller, but ps3 controllers can't be paired over bluetooth, only wired. I'm really looking for a solution of a controller that works :(