Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Working Bluetooth controller for making games in vr on android ?

Discussion in 'AR/VR (XR) Discussion' started by educa, Apr 17, 2017.

  1. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    Hi there,

    I spent all evening figuring out how I could get some bluetooth controller input into unity for vr development (need some input buttons ;) )

    I managed to pair a PS3 controller with my iMac and I also was able to do all keymappings, but.... a ps3 controller cannot be paired with an android phone unless it is rooted (a no go for me)

    The I tried a little vr controller called vr box controller (couple of dollars) and that controller could pair with my iMac and I even could check buttons with the Mac App "Enjoyable" where It really read buttons and their corresponding numbers. But in unity ... a no go.

    So now I'm actually looking for a make / model of controller that is actually working, even if I could only read 1 single button from it. Anyone have tips/hints ? What do you use yourself ?

    Kind regards,

    Bart
     
  2. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
  3. educa

    educa

    Joined:
    Mar 3, 2015
    Posts:
    14
    I understand, but please allow me to clarify. I'm not looking for a way to enable a vr controller or gamepad in a game which I want to put on the playstore.

    I just look for 1 controller which is known to work with at least 1 button to pair on my personal phone. I'm a primary school teacher and would like to create some very small immersive activities in unity which should happen in vr and where kids need to trigger something.

    The VR glasses (cheap mount) have a button on them which act as a screen tap, so technically speaking I could use that button, but I'd rather let the kids have 1 or more buttons on a gamepad.

    I do understand for 100% that releasing a game relying on a gamepad (on the play store) is asking for troubles because almost nobody will be able to play it, but I need kids to look at things and then push a button to confirm that hey want to select something (or shoot something). Gaze input is not the best solution in this specific case.

    In 1 or your video's you even show a cube being moved by a bluetooth controller, so there are in fact controllers that work. I'm only looking to find 1 of those controllers for 1 specific in-house game which will run on exactly 1 vr headset ;)

    Hopefully somebody can give me names or links to controllers that DO work.

    I do understand that the most immersive way is with gaze input, but I really need this for this 1 specific case ;)

    Kind regards,

    Bart
     
  4. Selzier

    Selzier

    Joined:
    Sep 23, 2014
    Posts:
    652
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,992
    i've seen people plugging even normal mouse to android devices.. i guess that would register as mouse clicks in unity?
    (without showing cursor, just use the button clicks)

    other alternative
    - tap detection (using gyro to detect if user tapped the helmet/device hard enough..)
     
  6. ARGallie

    ARGallie

    Joined:
    Sep 28, 2013
    Posts:
    1
  7. arfish

    arfish

    Joined:
    Jan 28, 2017
    Posts:
    777
    Hi

    I haven´t tested on Mac, but bluetooth controllers like VRBox works fine on Android. It maps to Input.GetAxis() for the joystick, and GetButton() for fire1 and fire2, jump, "cardboard-button", and so on. One trick is to select mode for the controller. Function key @ + B, sets the controller in game mode for the inputs to work. If you select @ + D, it works like a normal mouse with a mouse cursor on your phone display (in game mode, only the A, and D buttons, and the joystick are active).

    One like this:
    https://www.ebay.com/itm/Wireless-B...For-iPhone-Samsung-Gear-Android-/302132331402

    The VR Box joystick I have is on-off style only, zero or one in each direction. Like playing a game with only keyboard inputs.

    I have tested this one to:
    https://www.ebay.com/itm/Wireless-Bluetooth-Gamepad-Joystick-Remote-Selfie-Controller-For-Android-iOS-PC/132104238900?var=431453992482&_trkparms=aid=222007&algo=SIM.MBE&ao=1&asc=41375&meid=3b2dceb9955c42d1b01df23c9cb02ed6&pid=100011&rk=6&rkt=12&sd=252416768049&_trksid=p2047675.c100011.m1850
    It works in a similar way as the VR Box but it´s tricky to pair with the device over bluetooth, and tricky to set in game mode (perhaps mine is broken...). The upside is a smother joystick with analogue outputs.


    If you have a standard bluetooth computer mouse, and only need the cardboard-button, it should be fine to.
     
    Last edited: Jan 30, 2018
    jarbascjunior likes this.
  8. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    881
    Steel series and Xbox controllers both work great.
     
  9. SimRuJ

    SimRuJ

    Joined:
    Apr 7, 2016
    Posts:
    247
    Since SteelSeries and Moga got mentioned: Has anyone got the right keybinds for them?

    I own both a SteelSeries Stratus XL and a Moga Pro Power and none of the buttons work with e.g. "joystick button 0" (which should be the "A" button) in the InputManager. My code does work on PC with the Xbox 360 controller, which you can't use with your phone.
     
  10. theFinder

    theFinder

    Joined:
    Apr 30, 2016
    Posts:
    17
    PS4 controllers work. They do have a little lag, so I usually connect with OTG cable. And the button/axis mapping is not the same as all other controllers, but still very usable and a lot of people have these controllers already. Here is the mapping for the buttons on android (using "Cross_Platform_Input" in player settings and the standard "Input Manager":
    X, joystick button 1
    Circle, button 13
    Triangle, button 2
    Square, button 0
    R1, button 14
    R2, button 5
    R3, button 10
    L1, button 3
    L2, button 4
    L3, button 11
    Start, button 7
    Select, button 6
    Touch Panel as button, button 8
    the standard X and Y axis's can be used for the left analog
    the right analog axis's are the 14th and 15th axis.
    I forgot the axis's for the directional pad though.
    Also, these may not necessarily be the correct button mapping for PS4 controllers on non android devices (PC, etc.).
    I've used this mapping for bluetooth and non bluetooth connections to at least a handful of different android devices , from cheap pre-paids all the way to pixels.
     
  11. FURKANKAHVECI

    FURKANKAHVECI

    Joined:
    May 12, 2013
    Posts:
    25
    Microsoft Xbox One S Wireless Controller works on android oreo (via bluetooth).