xbox controller input script problem

So I’m trying to move the Cube on X and Y axis using my joystick or the pads or whatever it’s called…



Sadly it doesn’t work

I followed this tutorial like a 100 times, it works for it’s viewers, but not for me really… https://www.youtube.com/watch?v=PtkGLGE7ewU

Now I tried everything, appearently my xbox controller is perfectly OK, joy.cpl (see the screenshot) shows me that the pads are fine, even when I connect the joystick sensor to… let’s say simple motion actuator, it works, but the script just doesn’t want to work…
It doesn’t work with older versions (tried 2.66a and 2.62) and when I tried .blends with any kind of different script that was supposed to do the same thing, it didn’t work either.

-Am I missing some drivers?
-Am I missing some python libraries?
-Did I get the naming of the objects wrong? (it’s all copy-pasted from the tutorial)
-Does the sensor have wrong settings? (index etc.)
-Do I need to change some input Blender settings?

I just don’t know, I’m planning to use it as a motion recorder, so when you play a game, it records the motion, and you can then make a video with a preview of the pad’s motion… Please, any advice?

I made a simplier version of using game controllers(well simplier to implement than directx on an opengl surface using python), if you want to use it you’ll have to compile the driver libusb for win32(not a small download for the DDK but its far more usefall than the SDK), then find the pid/vid and use the w32api OpenCreate function to open the usb device but then hey you can write a driver for anything in userland after that. see my website for a script implementing a game controller in python at http://sites.google.com/site/abstractind

I have not not followed the tutorial but this is how it works for me:


import bge


# --------------------------


# For Joystick Sensor 
# joystick = bge.logic.getCurrentController().owner.sensors['Joystick']


# For Always Sensor
joystick = bge.logic.joysticks[0]


# For Joystick Sensor should print "Joystick"
# For Always Sensor should print "Controller (XUSB Gamepad)"
# print(joystick)


# --------------------------


axis = joystick.axisValues


# For Joystick Sensor axis ranges are from -32.000 up to 32.000
# so to normalize the input speed you could do: 1 / 32.000
# joySpeed = 0.00003125


# For Always Sensor ranges are from -1 to 1
# so you might leave it as is
joySpeed = 1


# --------------------------


axis[0] *= joySpeed
axis[1] *= joySpeed
axis[2] *= joySpeed
# print(axis)


player = bge.logic.getCurrentController().owner
player.applyMovement((axis[0], axis[1], axis[2]))

Personally I use “Always” sensor because it seems more handy, I prefer mostly to keep blocks almost at minimum and put all of the “logic” in the scripts.