OK, I bought a PS3/PC game controller. My computer detects the controller and I know what button are assigned what number. How do I get Blender to detect the controller? I’ve tried a few things and nothing happens.
get ubge and take a look at bge.logic.joysticks
Well that’s weird, tried everything under the sun yesterday and couldn’t get it to work. Decided to give it try this morning and blender decided to detect the controller. Had to do a little trial and error to figure out how the buttons worked in blender, cause it didn’t seem to match what my computer was telling me. The hat logic brick didn’t seemed to do anything at all. The single axis option worked the R2 and L2 buttons, the axis option worked the left and right joystick, and everything else worked using the button option.
I downloaded it the other day. It won’t work using my current computer. Haven’t tested on my new computer.
Take a look at this topic:
i posted a mobement script inthere aswell, using a joystick brick and the python commands.
and you find some more info aswell.
you don’t need upbge, and ppl need to stop promoting it inhere.
Hmm, this is interesting.
So you can use a controller with the game engine, and only using the brick setup too? What type of controllers? I have a PC/PS2 designed controller, the only buttons that work are all of them with the exception of one of the analong sticks and R1 they wore out. When I’ve used it to play Grand Theft Auto Vice city, and San Andreas, GTA 3.
Its now six years old.
The single axis option worked the R2 and L2 buttons, the axis option worked the left and right joystick, and everything else worked using the button option.
Yup, that’s the way my X-Box controller works in Blender (Not Unity or UE4, only Blender) But you can change the logic bricks to make it work in most cases. Which is an improvement, since it hasn’t worked at all since 2.72.
So you can use a controller with the game engine, and only using the brick setup too?
Yes, in UPBGE, not sure about Blender 2.77/78. I use X-box controller.
I can only use 2.76a on Windows XP.
Does the hat option do anything for you? Guess it’s all trial and error when figuring out what works in blender with what controller. The L2 button worked when using “axis” option, when setting the axis number to 3. I tried 4 or any other number and I couldn’t get the R2 to work til I switched to the “single axis” option.
Right now I got this working on my Windows Vista computer and 2.76 right now. It’ll be interesting to see if it still works the same when trying windows 10 and 2.77. Can’t do much with blender on this computer, it crashes to much. Get over like 20,000 vertices in a layer /scene and there goes blender,LOL.
Does the hat option do anything for you?
Yes, up, down, left, right, upright, upleft, downright, downleft, all works in UP-BGE 2.77. I’m a happy camper.
Using Winblows 8
In python:
from bge import logic
class public:
gamepad = 0
for gpad in logic.joysticks:
if (gpad != None):
gamepad = gpad
def ifGamepadConnected():
if (public.gamepad != 0):
message = "Gamepad %s is connected!!!"
print(message%(public.gamepad.name))