0

I would like to use a controller with a game I'm writing. I use the LWJGL Controller class to read the controller state.

The state of the triggers seems to have been summarised into a single value that represents the sum of the state of both triggers. The left trigger state is a value that varies between -1 and 0, the right between 0 and 1.

I currently use the getAxisValue() method to get the combined state.

I would like to be able to read these values separately. Is there any way I can do this?

Bartvbl
  • 2,878
  • 3
  • 28
  • 45

1 Answers1

0

The "Combined trigger axis" issue is caused by DirectInput. JInput uses DirectInput to poll the 360 controller. In this article is explained that the combining of axis was an intentional change to keep compatability with legacy games.

Quoting the article:

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. `

LWJGL can not offer separate trigger values because it in effect relies on DirectInput.

The best course of action would be to find java bindings for XInput, which does allow separate trigger values.

Community
  • 1
  • 1
Bartvbl
  • 2,878
  • 3
  • 28
  • 45