not sensing joystick connection?

This is weird and frustrating.

I have a very simple script that senses if a joystick is connected.

All I used was the variable connected which senses if there’s a controller connected right? Well, it doesn’t, when I start the game, it senses it once and that’s it.

For example, if I have the controller plugged in, then start the game engine, it senses the controller. If I unplug it, it doesn’t sense that the controller was unplugged, the connected variable stays on True. It’s vise versa if I have the controller unplugged when I start.

Any ideas?

I would post a .blend, but it’s too simple. It’s literally just using the connected variable, with an always and a joystick sensor connected to the python script. What could be the problem?


First: Close all blender related applications.
Second: Plug in your controller.
Third: Start Blender again

If that doesn’t work, check the drivers. Does the controller work with other applications?

Hi Linkxgl,

I tested with my USB XBox controller on Linux Mint 9, and I’m having the same problem. KX_JoystickSensor.connected stays True when I pull the plug. I’m using Blender 2.53+ from a recent SVN build (rev 31206). Sounds like a bug to me, unless we’re misunderstanding the function of KX_JoystickSensor.connected. I’d say you should probably file a report in the tracker:

Remember to include a sample .blend demonstrating the bug.

@C-106 Delta, I’ve tried that and it didn’t work, the controller works other application like XPadder, so I think it’s something else in Blender.

@Blendenzo, I guess I’ll have to. It’s weird because if I have the controller plugged in and try to activate a actuator with it, it works. If I unplug it, obviously the actuator doesn’t work, but when I plug it back in it works again. I’m still going to report the bug, just because I would like to use it. :wink:

Thanks guys!

Thank you for your information,I like to solve problems,I hope I can do something for you.