- Home /
I broke my double tap :(
So here is what I have. It should allow for the action to perform when an arrow key if double tapped within a certain time frame. That sort of works, but it also seems to randomly perform the action when an arrow key is let up after a long period of time. This is being called from inside fixedupdate() and using if(Input.getKeyUp(KEY)) So each time the key is released, if it's fast enough, it should, increment the counter by 1, and if that amount of time is NOT smaller, then it should set to 0. Do I need to set it to 0 elsewhere maybe??
function ANodeDown()
{
if(canBurst == true)
{
if(Time.time - lastAntiNodeDown < doubletaptime)
{
antiNodeDown ++;
}else {lastAntiNodeDown = Time.time;antiNodeDown = 0;}
if(antiNodeDown == 2)
{
rigidbody.AddForce(0,23325,0);
antiNodeDown = 0;
canBurst = false;
CoolDownStart = Time.time;
}
}
if(Time.time - CoolDownStart > DTCoolDown)
{
canBurst = true;
}
}
Maybe I have to segment it decriment the counters and time without the keyup, from inside teh update??? Any help, even code, would be greatly appreciated.
Thanks!
Your answer
![](https://koobas.hobune.stream/wayback/20220613160353im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Double tap on iPhone very unreliable 2 Answers
When i double Tap single Tap function also Executing.. 1 Answer
[SOLVED] Walk, Run and Sprint with single key 1 Answer
How to make double buttons? 3 Answers
Problem With touch and double touch 0 Answers