Input documentation

Hello, I am trying to understand jMonkeys input system, and I am having trouble finding information, even in the javadocs. I created an input listener that is triggered on the mouse Y axis. I have negative set to ‘true’ but I always get a positive value.

In unity we get values between -1 and 1. I am trying to mimic this by using a clamp function to the given value returned in my input listener, but I can’t make heads or tails of the value returned. it seems to always be 9.765625E-4?

Similar behavior from AXIS_WHEEL

multiply it by tpf. Or divide. I forget which.

Thanks! I have read this thread a few times and for those coming from unity, it is important to note that even though you set the value of MouseAxisTrigger negative to true, it doesn’t mean the value you get in the listener will be negative!

Here is what I came up with that works (basically) the same as Input.GetAxis in Unity

String WHEEL_POS = "wheelPositive";
String WHEEL_NEG = "wheelNegative";
String YMOVE_POS = "yMovePositive";
String YMOVE_NEG = "yMoveNegative";

public AnalogListener analogListener = new AnalogListener() 
    public void onAnalog(String name, float value, float tpf) 
    	 if (name.equals(WHEEL_POS)) 
    		 mouseWheel = clamp(value, 0, 1);
    		 System.out.println(name + " = " + mouseWheel);
    	 if (name.equals(WHEEL_NEG)) 
    		 mouseWheel = -clamp(value, 0, 1);
    		 System.out.println(name + " = " + mouseWheel);
    	 else if (name.equals(YMOVE_POS)) {
        	 yAxis = clamp(value, 0, 1);
        	 System.out.println(name + " = " + yAxis);
    	 else if (name.equals(YMOVE_NEG)) {
        	 yAxis = -clamp(value, 0, 1);
        	 System.out.println(name + " = " + yAxis);
public void registerInput(InputManager inputManager) {
    String[] inputs = {WHEEL_POS, WHEEL_NEG, YMOVE_POS, YMOVE_NEG};
            new MouseAxisTrigger(MouseInput.AXIS_WHEEL, false));
            new MouseAxisTrigger(MouseInput.AXIS_WHEEL, true));
    		new MouseAxisTrigger(MouseInput.AXIS_Y, false));
    		new MouseAxisTrigger(MouseInput.AXIS_Y, true));
    inputManager.addListener(analogListener, inputs);