Page MenuHome

axisValues are different between Linux and Windows
Closed, ArchivedPublic


System Information
Ubuntu 14.04
Windows 7

Blender Version

Short description of error
With a Xbox 360 controllder pad, when I'm using bge.logic.joysticks[0].axisValues on Windows, I have 5 items, the two triggers are set on the third item with -1 for the left and +1 for the right.
On Linux, with the same joystick, axisValues returns me 6 items, the third one is only the left trigger and the last one is the right trigger. Plus, on Linux the default values for trigger are 0 until is the trigger is pressed once. After the rest value is -1.
The way of how the controller works is maybe more logical in Linux because the two triggers could be pressed at the same time.



Event Timeline

Vincent Girès (VincentG) set Type to Bug.
Vincent Girès (VincentG) created this task.
Vincent Girès (VincentG) raised the priority of this task from to Needs Triage by Developer.

I would think this is more a driver issue?

@Vincent Girès (VincentG) What do the 5 and 6 items correspond to in windows and linux?

@Campbell Barton (campbellbarton) I traced this back to SDL_JoystickNumAxes() so the problem is with SDL support/drivers?

Anyway the response to joystick input should be scripted in a consistent way, and it then should just work independently of the OS it is played on?

@Alex Fraser (z0r) do you have a demo of joysticks working, did you have any problems like this? Is the user the one who is supposed to attribute meaning to the axes according to the OS?

Indeed, the problem is probably because of the drivers that has maybe changed on Ubuntu 14.04. I've tested back the 2.69 version of Blender on my updated Linux OS and this difference between Windows and Linux is also there. I hadn't this difference before on Ubuntu 12.04.

Here is the input I have on Windows 7:
0 : x axis for the left analogic
1 : y axis for the left analogic
2 : left and right trigger. -1 for the left and 1 for the right trigger.
3 : x axis for the right analogic
4 : y axis for the right analogic

On Ubuntu 14.04, there is one more input.
0 : x axis for the left analogic
1 : y axis for the left analogic
2 : left trigger
3 : x axis for the right analogic
4 : y axis for the right analogic
5 : right trigger

Indeed, as far as I'm aware this is a driver issue. In order to fix it we would need to build up a large database of joystick configurations. Some users have software installed that re-maps the buttons at the OS level e.g. to make a Playstation controller look like an XBox controller. Others have drivers installed that make the joystick behave like a keyboard and mouse, which is horrible to work with :/ FWIW, my no-name Playstation 3 controller has the same configuration in Linux and Windows.

For my game, I wrote a Python module called bat.impulse that abstracts the configuration and allows re-binding of the keyboard, mouse and joystick at runtime. It allows the user to set up their controller manually. If you were keen, you could create a set of bindings for common joystick + platform combinations, and switch between them automatically.

bat.impulse also has a way of stacking up event handlers - so you can e.g. have the player character as the default handler, but when you show a menu the menu handler would override it. And there's some other cool stuff in there, like methods for mapping the joystick direction to a vector in 3D space according to the orientation of the character and camera.

Inês Almeida (brita_) closed this task as Archived.Aug 7 2014, 12:05 PM
Inês Almeida (brita_) claimed this task.

@Alex Fraser (z0r) 's answer is really the best we can provide at the moment, thanks for replying.
I'll add this to the input problems list as a reference