This is the testing Godot forums! All forum posts unique to this forum will be deleted! Please use the main forums here for any posts you want to keep. All forum rules still apply.

Gamepad Input Not Working, But Keyboard Is

martymarty Posts: 123Member

I've got my Input Map in Project Settings set to its defaults, which appears to have both the keyboard arrows and gamepad D-pad mapped to the same Up/Down/Left/Right events.

The keyboard works fine processing in the _process() method with code along the lines of 'if Input.is_action_pressed("ui_up").

But the gamepad does nothing.

So, what am I doing wrong?

Answers

  • CalinouCalinou Posts: 376Admin Godot Developer
    edited February 2018

    Does your gamepad work in the Joypads demo? It should be recognized there automatically.

  • skepsysskepsys Posts: 2Member

    I don't have a link as of this post, but there is a good amount of info in the docs on _input(event) which deals with all input. Might be worth a look. Good luck!

  • martymarty Posts: 123Member

    Thanks guys, but still no luck.

    I had previously tried the Joypads demo and it indicates that the gamepad is being read just fine. I've also scoured the Godot docs and API reference, as well as various online materials - all to no avail.

    Keep in mind, I'm getting gamepad axis and button deltas in GDSCript just fine. And my code in the _process() method such as 'if Input.is_action_pressed("ui_up")' is return the appropriate values when I hit the keyboard arrow keys. What I'm not seeing though is 'if Input.is_action_pressed("ui_up") returning the expected values when I manipulate the gamepad.

    Any ideas?

    Thanks for you help!

  • MagicLordMagicLord Posts: 578Unconfirmed
    edited February 2018

    @marty said:
    Thanks guys, but still no luck.

    I had previously tried the Joypads demo and it indicates that the gamepad is being read just fine. I've also scoured the Godot docs and API reference, as well as various online materials - all to no avail.

    Keep in mind, I'm getting gamepad axis and button deltas in GDSCript just fine. And my code in the _process() method such as 'if Input.is_action_pressed("ui_up")' is return the appropriate values when I hit the keyboard arrow keys. What I'm not seeing though is 'if Input.is_action_pressed("ui_up") returning the expected values when I manipulate the gamepad.

    Any ideas?

    Thanks for you help!

    Input.is_action_pressed("ui_up")returns true or false, it does not return axis value.

    Let's say input mapping have joystick 0 with Left axis and Right axis setup,
    to read the joystick axis values you need that code
    Input.get_joy_axis(0,0)
    It works , you'll get values from 0 to 1 with joystick moving.

  • martymarty Posts: 123Member

    Your suggestion is very helpful information!

    Actually though, in my mapping, I am using the defaults, which appear to be intended return values for the d-pad. But when I hit the d-pad, I get no deltas of any kind. If I hit an arrow keys on the keyboard though, I do get them.

    What I really want to read is the d-pad.

    Any idea what I'm doing wrong?

  • MagicLordMagicLord Posts: 578Unconfirmed
    edited February 2018

    @marty said:
    Your suggestion is very helpful information!

    Actually though, in my mapping, I am using the defaults, which appear to be intended return values for the d-pad. But when I hit the d-pad, I get no deltas of any kind. If I hit an arrow keys on the keyboard though, I do get them.

    What I really want to read is the d-pad.

    Any idea what I'm doing wrong?

    I am not sure it's in the defaults or defaults is really using joystick.

    Why can't you add your Dpad directions in Input Mapping to get it working ?
    And don' t worry, when you deploy your game it embed the Input mapping settings.

  • martymarty Posts: 123Member

    Heya, ML.

    The Input Mappings settings by default have both arrow keys and d-pad vectors set as the input sources for 'Input.is_action_pressed("ui_up")'. And that's how mine are set. Yet, when I run code using 'Input.is_action_pressed("ui_up")' and the like, only the arrow keys delta that code.

  • SolarLuneSolarLune Posts: 37Member
    edited February 2018

    Each gamepad has its own controls, unfortunately, so it might be that the d-pad's actually a different set of buttons from what it is for other gamepads (i.e. maybe the d-pad isn't registered as a hat, but as buttons, when Godot is expecting a hat). What kind of gamepad is it? Could you try other buttons?

  • martymarty Posts: 123Member

    It's a SteelSeries Nimbus. When I run the Joypad Demo, the d-pad seems to be working fine.

Sign In or Register to comment.