I’ve been working on getting input from an xbox 360 controller on Android lately. Xbox 360 controllers are apparently natively recognised by Android Honeycomb and above. See this video for an example: http://www.youtube.com/watch?v=9Omyv6YzBmA
I’ve been personally working with an actual wired controller but I would expect this previous method to work just as well.
Anyway, I haven’t found any reference about the xbox 360 controller button names on Android and they are slightly different from their mac (with tattie bogle drivers) and windows counterparts. Here’s what I found:
A: “joystick button 0”
B: “joystick button 1”
X: “joystick button 3”
Y: “joystick button 4”
Left Bumper: “joystick button 6”
Right Bumper: “joystick button 7”
Back: KeyCode.Escape
Pause: “joystick button 11”
Left analog stick button: “joystick button 13”
Right analog stick button: “joystick button 14”
The big central button with the xbox logo acts as an Android “Home” button
And the axes are the following (left is negative x, right is positive x, up is negative y and down is positive y):
Left analog stick: Horizontal / Vertical axes as set in the default input settings
Right Analog stick: x = 3rd axis, y = 4th axis
D-Pad: x = 5th axis, y = 6th axis (these ones only return integer values, i.e. -1 when the negative button is pressed, 1 when the positive button is pressed and 0 otherwise)
Yeah, you plug the controller in your phone/tablet’s micro-USB port through a micro USB → female USB adapter. You can either directly plug in a wired controller, or use an xbox 360 wireless receiver and sync it to your 360 wireless controller.
These keys only apply to the xbox 360 controller on Android though, I have no idea whether or not the PS3 Sixaxis controller works with the same button names.
What’s weird to me is that the Unity-Documentation states that keyboard and joystick input only works on desktop versions.
Is there anything specific to set up in the input settings or will it work just the same as on desktops (except for the keycodes ofc.). What I mean is, do I have to set the type as “joystick axis” when setting up an axis or maybe something else?
Why would you want to do this? Hmm, I guess if you made a game for ultra high end tablets someone might plug a controller in to play it. Maybe for OUYA?