How to copy Xbox controller axisValue to a property ?

Title says it all. How can I copy the x and y values of the left and right stick (separately) of a 360 controller, to use these properties after ?


from bge import logic

joystick = logic.joysticks[0]
axis = joystick.axisValues

#             X1    Y1   X2   Y2
# axis -> [0.0, 0.0, 0.0, 0.0]
# X1, Y1: Left stick
# X2, Y2: Right stick


logic.joysticks is a list of SCA_PythonJoystick: http://www.blender.org/api/blender_python_api_2_65_3/bge.types.html#bge.types.SCA_PythonJoystick

Don’t forget to check the list length to avoid errors!

Thanks mate !