Tested if a joystick axis is not the nullAxis before assigning action to it.

experimental
Nehon 10 years ago
parent 34220640aa
commit 57dd2748e2
  1. 6
      jme3-core/src/main/java/com/jme3/input/DefaultJoystickAxis.java

@ -72,8 +72,10 @@ public class DefaultJoystickAxis implements JoystickAxis {
* @param negativeMapping The mapping to receive events when the axis is positive
*/
public void assignAxis(String positiveMapping, String negativeMapping){
inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
if (axisIndex != -1) {
inputManager.addMapping(positiveMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, false));
inputManager.addMapping(negativeMapping, new JoyAxisTrigger(parent.getJoyId(), axisIndex, true));
}
}
/**

Loading…
Cancel
Save