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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

I need help scripting a double-tap in visual scripting

Discussion in 'Visual Scripting' started by Mjhenning, Jun 9, 2022.

  1. Mjhenning

    Mjhenning

    Joined:
    Mar 15, 2022
    Posts:
    3
    This is the current script I have set up to try and detect a double-tap for a dash action.
     

    Attached Files:

  2. Mjhenning

    Mjhenning

    Joined:
    Mar 15, 2022
    Posts:
    3
    I apologize I just realised none of the values can be seen
     

    Attached Files:

  3. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    380
    Might be a lot simpler if you use a timestamp. When you press the button, you check current time - timeStamp =< dashAllowedTime resulting in 2 options, both starting with timeStamp = currentTime.
     
  4. Mjhenning

    Mjhenning

    Joined:
    Mar 15, 2022
    Posts:
    3
    It could simplify it but the problem is that both on input system event button's trigger at the same time causing the character to constantly dash.
     
    Last edited: Jun 9, 2022
  5. Trindenberg

    Trindenberg

    Joined:
    Dec 3, 2017
    Posts:
    380
    I'm not sure on the new Input system, but if it doesn't have a down/held/released, you can add a boolean check isHeld, so part of the routine operates if held and branches back into whether held or not.