diff --git a/engine/src/core/com/jme3/input/InputManager.java b/engine/src/core/com/jme3/input/InputManager.java index 9c49032c7..8c76c77b6 100644 --- a/engine/src/core/com/jme3/input/InputManager.java +++ b/engine/src/core/com/jme3/input/InputManager.java @@ -324,12 +324,28 @@ public class InputManager implements RawInputListener { } else if (value < 0) { int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, true); int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, false); + + // Clear the reverse direction's actions in case we + // crossed center too quickly + Float otherVal = axisValues.get(otherHash); + if (otherVal != null && otherVal.floatValue() > axisDeadZone) { + invokeActions(otherHash, false); + } + invokeAnalogsAndActions(hash, -value, true); axisValues.put(hash, -value); axisValues.remove(otherHash); } else { int hash = JoyAxisTrigger.joyAxisHash(joyId, axis, false); int otherHash = JoyAxisTrigger.joyAxisHash(joyId, axis, true); + + // Clear the reverse direction's actions in case we + // crossed center too quickly + Float otherVal = axisValues.get(otherHash); + if (otherVal != null && otherVal.floatValue() > axisDeadZone) { + invokeActions(otherHash, false); + } + invokeAnalogsAndActions(hash, value, true); axisValues.put(hash, value); axisValues.remove(otherHash);