Search Unity

Gamepad Input only works in right and up directions?

Discussion in 'Input System' started by schmidicow, Apr 15, 2019.

  1. schmidicow

    schmidicow

    Joined:
    Mar 23, 2014
    Posts:
    10
    Hi,

    currently testing the new Input System because i want to make a local multiplayer game.
    I set up the Inputs for WASD-Keys, works fine for now.

    When i test it with a gamepad, i use the same script and assign the left stick.
    Up and Right works as intended, but Down and Left always stays zero.

    I'm working with Unity 2019.1 and Input System Version 0.2.6

    Keyboard outputs a range from (-1.0, -1.0) to (1.0, 1.0)
    Gamepad outputs a range from (0.0., 0.0.) to (1.0, 1.0)

    Also at some point i got an error where left and down on gamepad was out of range.
    unfortunately i deleted the project that throwed the error, because i thought there was something broken.
    (i changed unity-version and wasn't sure if everything went fine..)

    Am i missing something for gamepad input or is this a bug?

    Looks like this is the problem i'm running into, but not sure:
    https://forum.unity.com/threads/input-system-bugs.647611/#post-4338934

    Also (as mentioned in the thread above) "Gamepad.current.leftStick.ReadValue()"
    works better, but when i try pushing down and left at the same time it results in (0.0, 0.0).
    BUT i can go left and also down, but not at the same time.

    Thanks in advance.

    edit: added some info
     
  2. gyl09

    gyl09

    Joined:
    Jul 21, 2017
    Posts:
    9
    Hi,
    I meet the same issue on gamepad stick (left and right), only up & right are working. If I use the dpad, it works.

    It seems the down/left stick directions are not recognized by the new input system. I've tried in binding section to use the "listen" button, push one of these directions and the expected path is not recognized, only the stick itself and the axis are proposed but not the specific direction.

    I test with a logitech F310, but not sure this issue is device specific.

    Thanks in advance.

    Regards,

    Guillaume
     
  3. Th0re

    Th0re

    Joined:
    Sep 4, 2015
    Posts:
    39
    Came here to report the same issue.

    Windows
    Unity 2019.1.0f2 (current)
    Using Input System 0.2.8 (current)
    Xbox One Controller
    Binding Path: leftStick/left [XboXoneGamepad], also same issue with others I tested.
     
    Kmoor likes this.
  4. Sir-Magic

    Sir-Magic

    Joined:
    Jul 20, 2015
    Posts:
    50
    Hi, I’ve had this issue too. What I eventually did was rather than using separate inputs for each direction, I bound the entire game pad’s left stick to my movement vector2. I then passed this through a script which would then get the angle and magnitude the stick was going relative to north. I could then determine which direction the player should move (for example, 315 to 45 degrees would be moving upwards).

    Hope this helps.
     
    camsha likes this.
  5. camsha

    camsha

    Joined:
    Nov 18, 2013
    Posts:
    11
    I too am having this issue with an xbox 360 controller. Similar to what Sir-Magic stated, I added a binding (not a composite) to my Movement action. For the binding path I just selected leftstick [Gamepad]. Then in my handler in my script I read the Vector2 value:
    Code (CSharp):
    1.     public void OnMovement(InputAction.CallbackContext context)
    2.     {
    3.         var dir = context.ReadValue<Vector2>();
    4.     }
    And I get values in the range of -1f to 1f for both axes.
     
    barisdincer, calbar and Iron-Warrior like this.
  6. SweGoat

    SweGoat

    Joined:
    Jun 1, 2018
    Posts:
    1
    I created a binding and just added "left stick [Gamepad]" to it.
    When reading the value i do:
    Vector2 direction = context.ReadValue<Vector2>();


    Haven't found any problems with that solution yet

    EDIT: Also, under Movement, continuous is checked
     
    Last edited: May 27, 2019
    echolink likes this.
  7. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    If you have issues like the original post, this may likely be device and OS specific - but we also landed a lot of fixes, so could you try if you get the same in 0.2.10?
     
  8. gyl09

    gyl09

    Joined:
    Jul 21, 2017
    Posts:
    9
    Hello,

    I tried the solution proposed by camcha, and didn't find leftStick option in dropdown list. Related to leftstick, only Press event is present.
    So I tried with LeftShoulder (which has the options of a stick... so maybe a display bug on the leftstick label), but taking this path, it didn't work at all, as expected as Leftshoulder is not a stick unlike what is shown in the dropdown list.
    upload_2019-5-30_18-41-3.png

    So for people who meet the same issue, I had to modify the path of the binding directly in the json of the generated class by replacing the path by this one:
    ""path"": ""<Gamepad>/leftStick"",
    EDIT: It's not a satisfying workaround as the modification is needed to be done each time the Input Action is changed and regenerated.

    Jonas, for a potential device/OS specific issue, I'm on PC on Windows 10 so nothing really fancy ;-).
    And I use the version 0.2.10 of the package.
     

    Attached Files:

    Last edited: May 30, 2019
  9. isaacinsoll

    isaacinsoll

    Joined:
    Mar 19, 2016
    Posts:
    4
  10. jonas-echterhoff

    jonas-echterhoff

    Unity Technologies

    Joined:
    Aug 18, 2005
    Posts:
    1,666
    OFG and Twin-Stick like this.
  11. OFG

    OFG

    Joined:
    Dec 6, 2017
    Posts:
    13
    This issue is still there. And it not gamepad specific issue.
    I tried with xboxone controller and logitech F310 on windows 10.

    2D Vector Composite does not work with controller sticks. Left and Right stick does not work with this binding. Only Up and Right is working. Left and Down is not working.

    Please fix this.


    . AddBinding.png Vector2Composite.png
     
    Last edited: Jul 10, 2019
    Th0re likes this.
  12. jeremies_unity

    jeremies_unity

    Joined:
    Oct 16, 2018
    Posts:
    26
    I have the same issue with the latest package.
     
    OFG likes this.
  13. OFG

    OFG

    Joined:
    Dec 6, 2017
    Posts:
    13
    Okey , This is fixed. But its not in the version that in the package manager!

    If you want fix for this , go and download from the github but the development brach. Dont download stable branch if you want fix for this.
     
  14. OFG

    OFG

    Joined:
    Dec 6, 2017
    Posts:
    13
    Please consider providing where did you push the fix and how to obtain fixed version :)