XBox 360 Controller Triggers

Archives Forums/Win32 Discussion/XBox 360 Controller Triggers

RiK(Posted 2008) [#1]
Anyone got any idea how to read the left and right triggers separately?

Basically in the standard driver they map onto +/- values for the Z axis, if they are both held you'll end up with a value of zero (ish).

Found some info on XInput here: http://www.codeproject.com/KB/directx/xbox360_cont_xinput.aspx

And from what I can see, XInput API stores them as two bytes in the structure so I'm wondering if I can hack the win32 joystick stuff to grab these values in their raw form.

Any tips much appreciated!


Yan(Posted 2008) [#2]
...so I'm wondering if I can hack the win32 joystick stuff to grab these values in their raw form.
I think this is a limitation of Winmm, which is the API Freejoy uses on Win32.

Other than 'write your own DirectInput/XInput mod/code', I'm not sure what to suggest. 8o/

[edit]
I'm assuming BMax usage. :o)
[/edit]


Ginger Tea(Posted 2008) [#3]
note: ive not looked at the posted link
nore do i program with blitz at the moment

ive wondered about this too
and the dpad (the ps3 pad gives the pad buttons but 360 is listed as hat)

i know about the values (not the exact ammount stated) from using the blitz3D joy commands
but lets assume that*

-1 left
+1 right
0 both buttons

so cant we tell blitz if joyz = 0 fire both weapons

*i got these values when i was using robs hover thing demo calibration screen

i know it gives a float value but im sure we can round it up to say im kinda pressed so lets just say i am pressed once i get to this point

edit:
its listing the same float number if i press both or no buttons but the hat does get read using the joyhat command ... pitty that and a few other buttons being mapped differently means atleast two confings 360, ps3 and god knows how many pc pads


Pongo(Posted 2008) [#4]

so cant we tell blitz if joyz = 0 fire both weapons


nope, that won't work. As you already found out, the triggers compete with each other in opposite directions, so having both pulled is the same as none pulled.

I know this is getting away from the original post, however. I know there *is* a way to split the triggers, but I don't know how it is done. I have played a racing game where this works. By splitting the triggers, you can keep the gas pressed and use the brake at the same time. If the triggers are not split, then pressing the brake will also take away the gas pedal.

Also, off topic to the original post, but as for configuring different sticks, it seems like every single one is different, even among the same manufacturer. Check the code archives for the joypad configuration code I have made. It is for b3d, but the basic concept should apply anywhere. This allows you to configure different sticks without having to plan for every option. It can easily be expanded to configure buttons and joyhat() as well.


RiK(Posted 2008) [#5]
I've got some code already to deal with various stick configurations etc. so that's not an issue. I'm really just interested in the specific problem of the triggers on the XBox 360 pad.

I've got a driver for the Mac which splits them into the Z and R axis so that's great on Mac and Microsoft's XInput API will read them ok, so I was really just wondering if anyone had already done a wrapper or something using that.