Am i correct that there is no jme.input.controls.binding which reads the POV (coolie hat) values from a joystick?
I asume that because i have a Logitech Extreme 3D, and everything works, except the POV.
Also i didnt find the lwjgl call controller.getPovX() in LWJGLJoystick and LWJGLJoystickInput
Thanks for answers
I am pretty sure this is a known issue in jME2.. Try the forum search.
Did so of course before posting a new topic ;)
Only thread i found that mentioned pov was:
http://www.jmonkeyengine.com/forum/index.php?topic=6521.0
Hmm,..maybe you have additional 2 axis for the pov-hat? Did you check that?
Thats what i would have expected. On an PS3 SixAxis everything can be accessed as Axis, btw.
I used /jme/src/jmetest/input/TestInputHandler.java and /jme/src/jmetest/input/TestJoystick.java,
they show every button and axis which have been detected, just not the Pov
After some digging i found out:
On the lowest level, jstest reading from /dev/input/js0 the POV is shown as axis4 and 5 - good
JInput test shows it as pov with values OFF, UP,DOWN,... aso - good
lwjgl provides functions getPovX(), getPovY(), isEventPovX() and isEventPovY() - good
jme2 seems to never use these functions - darn :|
Im not sure if this is the best solution, but i just added the Pov functions to LWJGLJoystick and LWJGLJoystickInput
so that they are available as two additional axis. Not very elegant but better than to add a new type besides axis and buttons.
Problem is i dont know how to detect if there is a Pov on the device, so the two additional axis are added always!
However, this patch works for me, also TestInputHandler and TestJoystick now show the pov as axis.
Index: src/com/jme/input/joystick/lwjgl/LWJGLJoystickInput.java
===================================================================
--- src/com/jme/input/joystick/lwjgl/LWJGLJoystickInput.java (revision 4960)
+++ src/com/jme/input/joystick/lwjgl/LWJGLJoystickInput.java (working copy)
@@ -91,6 +91,27 @@
listener.onAxis( joystick, controlIndex, axisValue );
}
}
+ // Changed by larynx 2010.04.05
+ // add support for POVs
+ else if ( Controllers.isEventPovX() ) {
+ controlIndex = joystick.getAxisCount()-2;
+ float axisValue = joystick.getAxisValue( controlIndex );
+ for ( int i = 0; i < listeners.size(); i++ ) {
+ JoystickInputListener listener = listeners.get( i );
+ listener.onAxis( joystick, controlIndex, axisValue );
+ }
+ }
+ // Changed by larynx 2010.04.05
+ // add support for POVs
+ else if ( Controllers.isEventPovY() ) {
+ controlIndex = joystick.getAxisCount()-1;
+ float axisValue = joystick.getAxisValue( controlIndex );
+ for ( int i = 0; i < listeners.size(); i++ ) {
+ JoystickInputListener listener = listeners.get( i );
+ listener.onAxis( joystick, controlIndex, axisValue );
+ }
+ }
+
}
}
}
Index: src/com/jme/input/joystick/lwjgl/LWJGLJoystick.java
===================================================================
--- src/com/jme/input/joystick/lwjgl/LWJGLJoystick.java (revision 4960)
+++ src/com/jme/input/joystick/lwjgl/LWJGLJoystick.java (working copy)
@@ -87,24 +87,39 @@
}
}
+ // Changed by larynx 2010.04.05
+ // add support for POVs
public String[] getAxisNames() {
Controller c = controller;
- String[] axises = new String[c.getAxisCount()];
- for ( int i = 0; i < axises.length; i++ ) {
+ String[] axises = new String[c.getAxisCount()+2];
+ for ( int i = 0; i < axises.length-2; i++ ) {
axises[i] = c.getAxisName( i );
}
+ axises[axises.length-2] = "POVX";
+ axises[axises.length-1] = "POVY";
+
return axises;
}
-
+
+ // Changed by larynx 2010.04.05
+ // add support for POVs
public int getAxisCount() {
- return controller.getAxisCount();
+ return controller.getAxisCount() + 2;
}
-
+
+ // Changed by larynx 2010.04.05
+ // add support for POVs
public float getAxisValue( int axis ) {
Controller c = controller;
if ( axis < c.getAxisCount() ) {
return c.getAxisValue( axis );
}
+ else if ( axis == c.getAxisCount()) {
+ return c.getPovX();
+ }
+ else if ( axis == c.getAxisCount()+1) {
+ return c.getPovY();
+ }
return 0;
}
Hmm,…maybe you have additional 2 axis for the pov-hat? Did you check that?
Mabye you have to use jinput directly. Found here a text, maybe this can help you:
http://fivedots.coe.psu.ac.th/~ad/jg2/ch11/GamePadIntro.pdf
good luck and keep us informed if you could do the job-
I am pretty sure this is a known issue in jME2… Try the forum search.
It has been fixed in jME3 though.