Use the stick angle of XBOX Pad ?

Hello Blender artists. I’ve started a fake 2D Shooter with a top view (smth like hotline miami) playable with XBOX pad (left stick to move and right to shoot). The cursor/aim follows the player and can be moved in a limited perimeter around the player with the right stick but it’s not very handy at the end because it’s hard to aim up,down,right, or left due to the fact the cursor stick a little in the angles of the square perimeter… That’s why I wonder is there is a python way to get the angle of stick to be able to quickly turn the player to the chosen direction. Sticks are axis so I don’t know if Blender can get that kind of values…

http://www.blender.org/api/blender_python_api_2_65_9/bge.types.html#bge.types.SCA_JoystickSensor

I almost have it working, however for some reason it grabs X from the left, and Y from the right stick on my xbox controller…

Thanks, I managed to get the values of both x and y axis but I still don’t know how to use them to set a direction :confused:

if inputX outside dead zone
own['X']+=inputX
if own['X']>own['MaxX']:
    own['X']=own['MaxX']
if own['X']>own['MinX']:
    own['X']=own['MinX']

same for Y axis


offset=own.worldPosition+(own.worldOrientation*Vector([own['X'],own['Y'],0]))

own['Cursor'].worldPosition=offset
own.alignAxisToVect(offset-own.worldPosition,0,1)

also, make the actor face the way he is moving,

and have the inputs apply force works as well,