Camera spins when Joystick is plugged in

I’m working on a game that includes joystick support. I started up the game with my XBox One Controller and the camera started spinning. Can this be fixed?

Most definitely.

Is it an xbone s or just an xbone pad?
The S pads should be fixed in 3.2. The thing is that jme’s gamepad input sytem was written by someone who prefers playstation pads and because of that every separate xbox pad needs to be remapped via a configuration file.

Try setAxisDeadZone to set a zone that ignores small constant values from the analog sticks.

Won’t work. What’s going on is that the system detects triggers as right joystick axes on xbox based controllers.
Technically you could stop the spinning by holding both triggers directly in the middle or by disabling flycam.

What??? This must be new. Since I used an XBox Gamepad before - triggers formed one axis and not pushing any triggers caused a zero value. Pushing one trigger down caused -1, pushing the other trigger down caused +1, pushing both triggers down caused zero.

There is a default remapping file already included with jme. If you used an xbox 360 pad, that one has been properly remapped for quite some time.

Yes, but … why hold down both triggers to the middle to stop some input coming in? As I said - these used to produce a zero when you did not hold any of the two triggers down - at the DirectInput-driver-level. The two triggers are summed up (which is odd, but okay). So they should produce zero when none is pressed, and zero if both are pressed to the maximum possible.

Ah … I just noticed … this is about XBox One gamepad. I only have a XBox gamepad.

Okay, I will test this with the jME 3.2 SDK and a XBox One Gamepad soon (will need to borrow one from somewhere) and compare with the jME 3.0 SDK. The TestJoystick.java class in the jME test project should reveal all input in an overview. Maybe @Spaceboy_Ross could do the same - there you will see what numbers are coming in for your controller.

xbox one controller

There are no events happening on the controller when the camera is spinning.

Did you run TestJoystick.java ?

Yes

And all axes / buttons had 0.0 / not pressed?
You could make a screenshot too -or- (better:) paste the log output / console output.
Usually you can see what happens this way.

Buttons and axes are 0.0 when the camera is spinning.

TestJoystick.java doesn’t have a (3D) camera.

In my game, the camera spins when I start it with the joystick.

To investigate this: Please start TestJoystick.java and post the output you see in the console / logfile.
It’s just a guess, but it might be that your gamepad produces some input - the standard FlyByCamera reacts to input from joystick / gamepad per default - and also to keyboard and mouse - see: [jmonkeyengine/FlyByCamera.java at master · jMonkeyEngine/jmonkeyengine · GitHub]

In my game, there are no logged events when the camera spins. I’ve programmed it to log events. In the test, it only outputs when I move any joysticks.

Okay, let’s try something different:
Question 1: What kind of camera does your game use - is it the FlyByCamera? (flyCam)
Question 2: Are you able to create a subclass in Java - e.g. to make a OwnCamera extends FlyByCamera?