I’m completely new to JME. I have a little project in which I would like to implement gamepad controls. Unfortunately, I find documentation on the use of gamepads rather hard to find. How do I do it? I tried treating it exactly as I would treat a keyboard (define mappings (with JoyAxisTrigger e.g.) in a listener which is registered to the InputManager) but unfortunately, this doesn’t work for me. What do I have to do to be able to use a gamepad?
A few places to look when you want to understand something in easiest to hardest order:
-test applications (there is a TestJoystick application in this case that might have made a bunch of things clear)
-the source code.
Edit: the first two may not have been 100% helpful in this case other than to confirm your current path… but the third one certainly would have helped. just have to know about it… and now you do.
Yes, there is even a tutorial that “simulates” a game pad’s input. I don’t have the link but will look for it because I distinctly remember copying the code and running it and it was insightful albeit I don’t use a gamepad which brings a question to ALL Monkeys which is;
I know game pads are used for that is why there was an example but in reality (here is the question) what percentage of JME games/apps actually use a game pad???
No offence to you @nesta.bentum, you brought up a great question and triggered another from myself of which I look forward to seeing for it is a curiosity to myself.
I tend to set it up in all of mine. Using Lemur, it’s pretty easy to use the same handling code for keys, joystick, and mouse. The code doesn’t care… so it’s easy to support it.
I think my Lemur Gem camera input example shows this:
When setting up your mappings, you can even have different scales for different axes, invert them, etc… very powerful. (and you can use it without the rest of Lemur as InputMapper works on its own, too… though Lemur is pretty nice even if I do say so myself.)
First of all: thanks for all your great contributions!
I just now wanted to take a look at the TestJoystick example and run it but unfortunately, I get an Exception saying that the assets cannot be found. How exactly do I have to run this example for it to work?
Okay, I managed to make the example executable…but it says that it cannot find any joysticks. I had my wired PS4 gamepad and my wire/-less XBOX One gamepad connected…none of them worked. Does anybody know why?