sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.69k stars 641 forks source link

How do you know which trigger is pressed ? #960

Closed Zayceur closed 6 years ago

Zayceur commented 6 years ago

Hello,

I have an issue. I want to get the state (and the analog value) of the right and left trigger. Both of these values are stored in the Z-Axis. The problem is when I press no trigger, the Z-Axis value is the same as if I press the two trigger at the same time.

Joystick.GetCurrentState().Z give me (exactly) the same value !

I use DirectInput.

Do someone have a solution to this issue ?

Thanks a lot.

Zayceur

Gavin-Williams commented 6 years ago

If this is for a gamepad, why aren't you using Windows.Gaming.Input.Gamepad ? I would suggest that's the best way to gather gamepad input, assuming your not on legacy windows. DirectInput is basically deprecated, it should not be used for mouse/keyboard, is not recommended for gamepads, isn't even available in UWP.

The wiki for DirectInput says ..

Advantage of XInput over DirectInput: When use with Xbox 360 Controller, the left and right trigger buttons will act independently, instead of as a single button[12]

that looks like it might be relevant to you.

Zayceur commented 6 years ago

Thanks a lot I moved to XInput !