I finally got my hands on an XBox style gamepad and was able to address some long-standing issues that folks have complained about. Being able to put hands on one was very educational.
First, I’ve added two new JoystickAxis constants:
LEFT_TRIGGER
RIGHT_TRIGGER
These map to logical IDs .rx and .ry… which in my pile of game controllers seems to map to all non-XBox style gamepads. For XBox they will be remapped in config. The issue is that generic and play station style controllers never seem to report anything but a generic name (even a PS4 controller only shows up as “Wireless Controller”) but I guess most Xbox controllers will have “xbox” in the name somewhere.
Second, along those lines, the joystick remapping support now allows for a regex normalization in joystick name. For example:
XBOX.regex=(?i).*xbox.*
…means we can create one button/axis remapping for “XBOX” and anything with the word ‘xbox’ anywhere in its actual name (case insensitive) will match.
I’ve left the old XBox controller configurations in temporarily but I’ve commented them out.
Third, the TestJoystick app has been updated to support the new LEFT_TRIGGER/RIGHT_TRIGGER axes.
On Playstation style controllers, the triggers are axes and also buttons so they get reported both ways. (Buttons 6 and 7 usually) For Xbox controllers, these seem only to be treated as axes… so the test joystick app accounts for this now.
If you build JME from source and have a controller to test, you might consider giving the TestJoystick app a whirl to see if it still works with your game controller after these changes.
Commits:
https://github.com/jMonkeyEngine/jmonkeyengine/commit/5901a95363b5e0675023fd5b61878cf829753c50
https://github.com/jMonkeyEngine/jmonkeyengine/commit/54b812ca7182afd2a1369baf42eabc44afe9d51b
https://github.com/jMonkeyEngine/jmonkeyengine/commit/59af265398839ec82115597ded8f296e4e320735