Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Gamepad HID Configuration

Discussion in 'Editor & General Support' started by Jopan, Oct 13, 2016.

  1. Jopan

    Jopan

    Joined:
    Jan 22, 2013
    Posts:
    11
    Hello, I am messing around trying to create a controller that is recognized by Unity's Input api. The controller has 8 buttons, a joystick, and orientation data. It connects to the computer through bluetooth and is currently showing up properly on http://html5gamepad.com/

    Screen Shot 2016-10-12 at 4.44.40 PM.png

    Axis0 is the X axis of the joystick and Axis1 is the Y axis.
    When I use Input.getAxis("Horizontal") with Horizontal set to be the x axis, the data comes through to Unity just fine. Same goes for the Y axis.

    When I use "joystick button 0" through "joystick button 7", I am also able to get those buttons to work in Unity.

    So here is the problem, currently I am storing the orientation data in the 6th axis to the 9th axis (x, y, z, w) in the HID table. But, when I try to retrieve Axis 7-10 in Unity (Unity starts at Axis 1 rather than 0 so I read 1 axis higher) no data is coming through.

    Can anybody at Unity, or anybody who has tinkered with this before shed any light on this problem? Why isn't the data coming through? How should I try to send the orientation data instead?