[3.1] error with Xinput gamepad axis

I guess you will have to wait until I release again, sorry.

I’ve tried with TestJoystick: unfortunately, the deadzone reported by the API is 0.0 for all axis :frowning:

Also checked the joystick and gamepads pdf that is floating around: deazone is always 0.0 for all axis for all joysticks and gamepads :frowning:

So I guess the latest lemur commit won’t help much on this issue…

Yep, I’ll have to make a mod to JME, also.

Can’t you throw out axe events that don’t have a minimum length, from your listener until it works out of the box?
I made a virtual joystick for android and that dead zone is a parameter of the constructor.

It would be nice if we could add these parameters to the joystick-mapping.properties
I think we might want to have pos / neg dead zone values for each axis somehow?
About the mentioned pdf - yes 0.0 everywhere:
Joysticks-and-Gamepads.pdf - Google Drive

I will add a setter to the axis so that the player can configure it through the in-game controller menu…

It can’t really be standardized on joystick type because they wear over time and may have different quality construction.

2 Likes

Just a note: I’ve modified JME head to have a setter for the axis dead zone. InputManager will now also pay attention to this setting. Lemur has already been modified to use it but I haven’t cut a release yet.

2 Likes

So, how do I change the deadzone? Thanks!

…with the setDeadZone() method…

…which belongs to the class…

“I wonder how I would set the dead zone on the axis…”

perhaps by calling setDeadZone on the joystick Axis object…

Maybe. could be crazy to try it. :wink:

Ah, maybe I didn’t update Lemur to the github master… :expressionless:

The setDeadZone() method was added to JME

Isn’t it the com.simsilica.lemur.input.Axis ?

No… that’s basically just an ID. It’s still JME that’s doing all of the joystick processing and InputMapper is just delegating to it.

…so I have a Lemur Axis, and a InputMapper. How do I get the corresponding JME Axis, so that I can call setDeadZone() on it? Thanks!

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: