Joystick

I have been killing myself this last week trying to get the joystick input working. I can get inputs from the joystick and print out the values when I move the joystick around, but there has got to be a simpler way to correlate joystick inputs to actual movements of the object. For instance I don't want to have to take the .4354, .2342, .3243 values i get from my joystick  and make this the new direction vector my guy moves in. Is there some sort of joystickHandler that is easy to use? Or will I have to turn these values into some sort of movement vector and apply them to my object I am trying to move?  :slight_smile:

Thanks for asking this question.  I am on the verge as well of getting down with joystick input, but I have not yet begun the endeavor.  I hope that your question provides some good feedback/discussion that will be a good starting point for anyone who wants to work with a joystick.



What type of joystick are you using?  Mine is a Logitech RumblePad 2 – in the PS2 style – which I hope will be functional in all ways with jME.

I'm not sure if this will help, also I'm going by the way it works for using LWJGL's input.



So the numbers your getting shouldn't be that hard to work with once you have the joystics layout.

Say for instance the left thumbstick. I'm guuessing its pressure sensitive because of the numbers you posted,

Well for up/down it has a value from -1 to 1.

0 being the center and the values can be up to 10 decimal places for testing pressure, and this might be called the YAxis, So I personally  would set up a conditional test, because I'm using an xbox controller and its quite sensitive it would be like


if (YAxis < -0.2){
               //code for moving forward here
          }
          if (YAxis > 0.2){
               //code for moving backward  here
          }



Then left and right on the controlller's left thubstick might be called XAxis

if (XAxis < -0.2){
               //code to turn left
          }
          if (XAxis > 0.2){
               //code to turn right
         }



Then with the right thumbstick, up/down are called YRotation(so it can get a little confusing when you first look at it), left/right are called XRotation, same thing again with values between 1 and -1.

So I don't really think the numbers are that hard to work with?

Hope this helps

Thanks guys for showing an interest in this topic. This is for a class and our project is due soon so we scrapped the idea of the joystick but I will comeback to this sometime in the future.