Game Engine Input

Hey lads, I’m having a few issues with blender’s input. Firstly, the keyboard (depending on which keys you press) does not allow certain numbers of keys being pressed at a time.

For example, I have a script that instead of just setting movement values according to which of WASD you press, it combines them (so if all of WASD are pressed, there should be no movement). The problem I’m having with this is that it seems to only recognise three of the button presses from that group of letters at once, whilst still allowing extra button presses from elsewhere on the keyboard. I suspect this is a hardware issue, but it happens on all 5 of my computers, so I’d like to be sure.

The second problem I’m having is that the joystick sensor picks up my controller’s analogue sticks but not the buttons. May I ask if the joystick sensor is the right place to be getting the button input from a controller?

wadsssssssssssssssssssssssssswadssssdawsssssssssdaws logitech k260 keyboard

if you are using linux you can download a program at getdeb that changes joystickbutton inputs into keyboardinputs

stupid idea, doesnt solve your problem

Concerning the controller problem, this may help. It’s documentation for Unity, but the actual input from a controller is universal in terms of keys, axis and bindings. (Though input varies according to OS, which is important.)
http://wiki.unity3d.com/index.php?title=Xbox360Controller
When using buttons, you should still use the joystick sensor, but set the event type to button. (On the linked page from Unity there is a button ‘map’ showing all of the button’s codes) this documentation from blender shows how to change event types on the joystick sensor.
https://www.blender.org/manual/game_engine/logic/sensors/joystick.html
Pressing WASD and still moving is normal. If you start up most games using WASD or arrow keys and hold down all 4, you will still move in the direction of the last pressed button. If it really bothers you, you could and another sensor to detect if all are being pressed at once, link them all to a single controller, which goes to an actuator to stop any movement.
Hope some of these answers helped.:slight_smile:

Thank you for the controller documentation for Unity, I’ll look into that :slight_smile:
As for the keyboard thing, I meant that Blender just doesn’t recognise when all buttons are pressed. If I print the active keys to the blender console, the output works for all keys, unless I press all four of WASD at once. For some reason, it can only accept three of those buttons pressed at once and I’m not sure exactly why. Maybe it’s just meant to be like that, although for the life of me I can’t figure out why.

It’s not a stupid idea :slight_smile: If all else fails, I’ll just use my linux machine to make a linux only game haha

Okay, the controller issue is sorted; turns out blender has support for DS4 analogue sticks and triggers but not the buttons. I just mapped the controller to xbox360 input and it worked. The keyboard issue is still at large, but I’ll just learn to deal with that.

The problem is what you originally guessed, it’s a core hardware issue. Most keyboards can only report so many keys at once from certain sections of the keyboard, and so ignore the other keys. This is due to the way most keyboards are wired and put together. Check “Key Jamming and Ghosting” under Wikipedia for a bit more information.

The only real thing you can do is reduce the number of keys you need pressed, or change which keys you need to press at any given time. Adding the ability to keybind would probably also be a good idea.

Here in korea they sell special “gamer” keyboards with bright orange WASD keys, but I don’t know if they have any improved hardware… I’ve never bought one.

As far as I know there only 3 simultaneously pressed keys are guarantied.

I think this is one reason, why the keyboard sensor is limited to detect three keys (key, hold1, hold2). With a “usual” keyboard I was able to get up to 7 simultaneously pressed keys. But this depends on the keys. Some combinations are limited to … three.

Therefore you better assume -> three.

It is more user friendly anyway.