Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)  (Read 47875 times)

0 Members and 1 Guest are viewing this topic.

jammasterj007

  • Newbie
  • *
  • Posts: 2
    • View Profile
Hey guys, I was just wondering if there is a way to receive the input for only one analog trigger as opposed to the shared Z value. I need to be able to tell when the user is pulling one/both/neither of the triggers.

Thanks,

James

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #1 on: June 21, 2013, 10:20:14 am »
The behaviour of the joystick is controlled by the driver, there's probably nothing I can do.

You should test with your OS joystick utility, and if the behaviour is the same, then I definitely can't do anything ;)
Laurent Gomila - SFML developer

jammasterj007

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #2 on: June 21, 2013, 04:38:54 pm »
Hey Laurent, thanks for the quick reply and for making SFML in general :)

I've been doing a little more research and the problem seems to be tied to DirectInput. Apparently XInput allows the triggers to be treated as separate axes. Is there any way for me to force my application (or windows) to use XInput instead?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #3 on: June 21, 2013, 05:34:19 pm »
No, SFML uses the multimedia library (winmm), not Xinput.
Laurent Gomila - SFML developer

NoobsArePeople2

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #4 on: June 29, 2013, 03:03:19 am »
It looks like SDL2 supports both DirectX (XInput) and WinMM (link) so it should be possible to implement in SFML. I imagine it's a fair bit of work though.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #5 on: June 29, 2013, 08:43:31 am »
If I remember correctly (and according to the wikipedia page), XInput is basically only for XBox 360 controllers.
Laurent Gomila - SFML developer

NoobsArePeople2

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #6 on: June 29, 2013, 06:47:53 pm »
That sounds about right.

I realize adding support for one specific gamepad probably isn't the highest priority but it would be really nice to have 360 gamepad support. I suspect 360 pads are one of the more popular gamepads on Windows as they're readily available and they just work on Windows.

That said, lack of XInput support is far from a deal breaker for me though. It's more a "nice to have".

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #7 on: June 29, 2013, 06:59:07 pm »
Quote
it would be really nice to have 360 gamepad support
To make it clear for other readers: XBox controllers are supported, it's just that triggers are merged into a single axis instead of being two separate axes.
Laurent Gomila - SFML developer

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #8 on: June 29, 2013, 09:22:56 pm »
Yeah but it makes it pretty much impossible to have usual controls for racing games (with brakes and acceleration on the triggers) or 3rd person shooter (get in firing position with left trigger and fire with right trigger). :(
And the 360 gamepad is one of the most common IMO.

NoobsArePeople2

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #9 on: June 29, 2013, 10:54:16 pm »
To make it clear for other readers: XBox controllers are supported, it's just that triggers are merged into a single axis instead of being two separate axes.

You are right of course. Aside from the triggers 360 pads work just fine. I should have written:

Quote
it would be nice to have full 360 gamepad support.

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #10 on: June 30, 2013, 09:22:26 am »
Just curious, how is it with PS3 controller? Anybody tested that?
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #11 on: June 30, 2013, 11:27:09 pm »
PS3 controllers won't work out of the box. They show up as a game controller but they don't actually work without third party drivers (at least on Windows). On Android they work out of the box, never tried one under Linux or Mac OS. Besides that, I'd say they should work just like any other gamepad.

NoobsArePeople2

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #12 on: June 30, 2013, 11:55:03 pm »
Just curious, how is it with PS3 controller? Anybody tested that?

I've done some testing with the PS3 pad on Windows (specifically Windows 8 ) and Mac OS (specifically 10.7). Haven't had a chance to do anything on Linux yet.

Windows

On Windows the PS3 pad won't "just work". To get the pad to work you need the MotionInJoy driver. The driver allows you to use the PS3 controller as a DX (assuming this is DirectInput) device and emulate the 360 controller (XInput).

Using the DX the triggers (L2 and R2) share a single axis but they also report digital button presses the same as pressing the X button. I noticed that the right analog stick only reports the correct values along its x-axis in this configuration. I'm getting values along y but they are not what I would expect.

In XInput mode the PS3 pads functions identically to the 360 pad -- everything works great except L2 and R2 share an axis.

All of the above is using the default configurations provided by MotionInJoy. In DX mode there are quite a few configuration options (you can customize the tilt controls offered by the SixAxis for example) and I was able to get L2 and R2 to report on different axes and resolve the issue with the right analog stick.

If you're determined I think you can make the PS3 pad fully functional with SFML on Windows in DX mode but it would hardly be "plug and play": you have to use a third-party driver that has annoying ads and you have to root around in said driver's unintuitive interface changing a bunch of settings.

To be clear this is a driver issue so I don't think there is much that can be done on the SFML end to remedy it.

Mac OS

Mac OS (since 10.6 I think) supports the PS3 pad out of the box via Bluetooth. This video explains how to pair the pad with OSX:



By default all the buttons work but L2 and R2 report as digital button presses not analog axes. I haven't spent much time playing around with the PS3 pad on the Mac so I'm not sure if you can configure it or not.

thePyro_13

  • Full Member
  • ***
  • Posts: 156
    • View Profile
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #13 on: July 07, 2013, 03:29:52 pm »
If I remember correctly (and according to the wikipedia page), XInput is basically only for XBox 360 controllers.

It's encouraged by Microsoft for all controllers(though hasn't been adopted) and games(some newer games seem to support Xinput controllers much better than DirectInput ones). It seems like some of the newer Logitech controllers use both Xinput and DirectInput(with some kind of physical switch to change between them).

I was doing a bit of reading into this and found this on MSDN(http://msdn.microsoft.com/en-us/library/windows/desktop/hh405052(v=vs.85).aspx). It looks like the Flight stick mapping does separate the triggers into two axis(Z and Rz). This might lead to a workable solution for full 360 controller support on Windows.

nydoc

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Re: Xbox 360 Controller Triggers Share Axis (Any way to isolate?)
« Reply #14 on: December 13, 2013, 04:23:47 am »
You can convert xinput to directinput and vice-versa with the following programs:

x360ce For Windows: https://code.google.com/p/x360ce/
x360ce Wine: http://www.reddit.com/r/linux_gaming/comments/1k1xe9/using_any_gamepad_to_simulate_xbox360_controller/ccdosx4

x360csai.exe wired and wireless controllers: http://archive.jonnys-place.com/index.php?topic=10495.0