|
[A5] Xbox360 Controller Trigger buttons = only one axis? |
anto80
Member #3,230
February 2003
|
Hello all, I'm using Allegro 5.0.10 and a Xbox360 USB Controller. This seems to be a common problem shared on other game engine. For example : http://answers.unity3d.com/questions/27878/triggers-on-the-360-controller-treated-as-one-axis.html The problem is:
Did any of you succeeded in detecting LT+RT input? Thank you ___________ |
RPG Hacker
Member #12,492
January 2011
|
One way to fix this could be to use DirectInput correctly or, even better, XInput.
|
anto80
Member #3,230
February 2003
|
RPG Hacker said: One way to fix this could be to use DirectInput correctly or, even better, XInput.
Sorry but I'm not following you. ___________ |
SiegeLord
Member #7,827
October 2006
|
Allegro 5.1 had a lot of work done with joysticks, in particular with XInput. I'd try 5.1 and see if it helps. "For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
torhu
Member #2,727
September 2002
|
RPG Hacker said: One way to fix this could be to use DirectInput correctly or, even better, XInput. When I set my Logitech F510 controller to XInput mode, LT and RT are treated as one axis. So I assume XInput wouldn't really help. In DirectInput mode, they are treated as buttons, not sticks. In both cases, Allegro 5.0 and the Game Controllers app that comes with Windows 8.1 give the same result. I haven't tested with 5.1, can't be bothered to build it... |
RPG Hacker
Member #12,492
January 2011
|
That's weird. Could that be a drivers issue? Or maybe they're even doing this intentionally. I don't know if there actually is a single XBOX 360 game where both triggers have to be used for different things at the same time.
|
Chris Katko
Member #1,881
January 2002
|
Has everyone missed the fact that this is by design? http://wiki.unity3d.com/index.php?title=Xbox360Controller (see section: Axises) Go to the Windows joystick calibration screen. It's only one axis because it's supposed to be a linked "throttle and/or brake" axis. XInput may allow separate per this one: https://forums.dolphin-emu.org/Thread-l-and-r-trigger-problem I know some Xbox games got around this limitation, but I've never heard of how they did it. [edit] Quote: If you only build your game for Windows, you may be interested in XInput.NET which allows full XBox 360 controller support. For an InputManager.asset file with four XBox 360 controllers mapped click here or with separate axises for triggers: click here Windows only [edit] Supposedily, you can download the Xbox 360 controller driver: https://www.microsoft.com/hardware/en-us/d/xbox-360-controller-for-windows And there's a config program to change whether or not the axies are linked. The point here is that it's not Allegro, and it's not a portable solution. [edit] Also, I forgot, don't forget to read Microsoft's insane "official reason": https://msdn.microsoft.com/en-us/library/windows/desktop/ee417014(v=vs.85).aspx Quote: However, some functionality provided by XInput will be missing from the DirectInput implementation: - The left and right trigger buttons will act as a single button, not independently The combination of the left and right triggers in DirectInput is by design. Games have always assumed that DirectInput device axes are centered when there is no user interaction with the device. However, the Xbox 360 controller was designed to register minimum value, not center, when the triggers are not being held. Older games would therefore assume user interaction. The solution was to combine the triggers, setting one trigger to a positive direction and the other to a negative direction, so no user interaction is indicative to DirectInput of the "control" being at center. In order to test the trigger values separately, you must use XInput. Devs are not happy with their explanation. (see comment section) [edit] On the brightside, apparently users were so fed up they made their own driver: http://vba-m.com/forum/Thread-xbcd-0-2-7-release-info-updates-will-be-posted-here To bring back the functionality that Microsoft ruined. Let's see how the pro-Microsoft people here try and spin this as positive. -----sig: |
Mark Oates
Member #1,146
March 2001
|
What are you using the triggers for? What game mechanic? -- |
anto80
Member #3,230
February 2003
|
in some cases, I had to hold both trigger and press another button while holding. Hold LT+RT and press A, for example. [Edit] ___________ |
Kris Asick
Member #1,424
July 2001
|
360 controllers were built specifically for XInput. They are able to interact with DirectInput through legacy support, but in doing so, certain things are not supported. One of those in particular being the ability to read the states of left and right triggers independently. Instead, they are reported as a single axis with one of the triggers going positive on the axis, the other trigger going negative. This is by design and there are NO workarounds to this if you stick with using DirectInput. Instead, either go up to the unstable Allegro 5.1.x branch which I believe supports XInput controllers directly (don't quote me on that, I use 5.0.x), or just code your own XInput support. XInput is extremely easy to use and using it directly will allow you to do things like rumble effects and reporting battery levels, things you can't do with a 360 controller if you stick with DirectInput. --- Kris Asick (Gemini) |
anto80
Member #3,230
February 2003
|
This seems great! Are there any Allegro examples which use XInput interaction? ___________ |
RPG Hacker
Member #12,492
January 2011
|
Using XInput is also great for providing default controls to players using an XBOX 360 Controller. Since that controller is probably the one being used by the most people for PC games, and since the buttons on the controller are known, you can not only provide good default controls for players using this controller, but you can also directly name the buttons on the controller. So instead of saying "press button 1" or "move axis 3" you could say "press A" or "press right trigger".
|
|