[3.1] error with Xinput gamepad axis

This is how JME maps a gamepad to Axis objects:

protected void mapGamepad( Joystick j ) {
        joystickAxisMap.put(j.getXAxis(), Axis.JOYSTICK_LEFT_X);
        joystickAxisMap.put(j.getYAxis(), Axis.JOYSTICK_LEFT_Y);
        joystickAxisMap.put(j.getAxis(JoystickAxis.Z_AXIS), Axis.JOYSTICK_RIGHT_X);
        joystickAxisMap.put(j.getAxis(JoystickAxis.Z_ROTATION), Axis.JOYSTICK_RIGHT_Y);
        joystickAxisMap.put(j.getPovXAxis(), Axis.JOYSTICK_HAT_X);
        joystickAxisMap.put(j.getPovYAxis(), Axis.JOYSTICK_HAT_Y);

        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_0), Button.JOYSTICK_BUTTON1);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_1), Button.JOYSTICK_BUTTON2);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_2), Button.JOYSTICK_BUTTON3);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_3), Button.JOYSTICK_BUTTON4);

        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_4), Button.JOYSTICK_LEFT1);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_5), Button.JOYSTICK_RIGHT1);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_6), Button.JOYSTICK_LEFT2);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_7), Button.JOYSTICK_RIGHT2);

        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_8), Button.JOYSTICK_SELECT);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_9), Button.JOYSTICK_START);

        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_10), Button.JOYSTICK_LEFT3);
        joystickButtonMap.put(j.getButton(JoystickButton.BUTTON_11), Button.JOYSTICK_RIGHT3);
    }
1 Like

Well… I guess I should do

inputManager.getJoysticks()[0].getAxis("MyAxis").setDeadZone(...)

However, I noticed that there is a

InputManager.setAxisDeadZone(...)

So I should just use that instead if I want to set the deadzone globally?

Lemur doesn’t use that deadzone because it’s only used inside of InputManager for its non-raw input listener processing. It’s better to do it on the axes because every joystick could have different drift.

Edit: I suppose I could have Lemur check the global one also… I’ll look into it soon.

Edit 2: I just modified Lemur head to pay attention to InputManager’s dead zone. It takes the max of the axis and input manager’s dead zone and uses that.

2 Likes

Awesome! And here’s a PR for Windows 10 Added support to Logitech F310 with Xinput for Windows 10 by Pesegato · Pull Request #401 · jMonkeyEngine/jmonkeyengine · GitHub

:smile:

Merged.

1 Like