Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Controller stick causing too many actions to occur when pushing in a given direction.

Discussion in 'Input System' started by Thaelabrrahim, Aug 17, 2021.

  1. Thaelabrrahim

    Thaelabrrahim

    Joined:
    Feb 4, 2021
    Posts:
    2
    Im a newer developer trying to design a fighting game style input, wherein each direction is mapped to a number, then on a button press the attack checks to see what the last three numbers in the list were, for example, a stick starting down and rolling forward is a quarter circle forward or a 236.
    This all works perfectly on keyboard because each direction can only be called once because WASD are buttons, but upon switching to controller i run into the issue that ever tiny micro angle of the controllers left stick, starts a new input action, resulting in the action of pressing down, filling my list with 2's where it should only input one until the stick returns to neutral and then pushes down again.
    ideally i dont want to seperate out code for inputs based one one method or the other as everything is based around input actions
     
  2. Rene-Damm

    Rene-Damm

    Unity Technologies

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    You can treat the stick like a dpad by binding to the up/down/left/right "synthetic" buttons on the stick using a Vector2 composite and setting it to "digital" mode.

    upload_2021-8-18_22-57-57.png
     
  3. Thaelabrrahim

    Thaelabrrahim

    Joined:
    Feb 4, 2021
    Posts:
    2
    This is not what im having trouble with, more that each individiual micro angle of the controllers stick causes a new input action / thinks its pressing a whole new button.
     
  4. SkylorBeck

    SkylorBeck

    Joined:
    Aug 29, 2020
    Posts:
    13
    Did you ever figure out a good solution? Having the same issue.
     
  5. SkylorBeck

    SkylorBeck

    Joined:
    Aug 29, 2020
    Posts:
    13
    In addition to the above suggestion, I was able to solve my problem by adding a "Press Only" trigger behavior on the vector 2 composite.
    upload_2023-5-21_10-28-25.png