- Home /
Touch.deltaTime confusion
When I Debug.Log(Touch.deltaTime) I get weird times such as 0 0 0 0.00023 0.0052 and so on.
I need the time in seconds how can I do that?
Like I want to know how FAST the user is tapping the screen.
How can I achieve that? Thanks
Define 'Fast'. Do you mean how hard the user is pressing the screen? Because I'm not sure that you can actually know that. Touch.deltaTime is telling you the amount of time between inputs- it doesn't tell you how fast the user is doing anything, it tells you how fast your refresh rate is on the touch inputs!
Thats exactly what I want to know the Time between the touches. For example the faster ($$anonymous$$ore touches in lesser time) the speed of the character should increase. Nothing to do with a single hard touch.
Just like if time between touches is little it should move faster and if the time is large (slow touches) the speed should decrease. I have a var called speed So all I want to do is When fast touch--> speed +=1; and when slow speed -=1;
Ok then. Well, if you're looking for the time between individual touches (on-off-on-off) then Touch.deltaTime isn't what you're after. Touch.deltaTime will give you the time between updates of the same touch. Ins$$anonymous$$d, you should have some kind of counter which checks for the beginning of touches, and increments some kind of touch density counting algorighm. So, if you have x touches in y seconds, the speed changes accordingly.
Oh I get it.
So theres no inbuilt feature for that? I ll have to use something like if (touch.phase == iPhoneTouchPhase.Began) var a += 1;
But then what :/
Well, then every second (or half a second or whatever), you poll it to see how many touches have been made in the last second! Or, you could see how long there is between touches. There are a few different ways, but I'm sure you can work one out yourself. It doesn't require any program$$anonymous$$g knowledge, you just have to know exactly what you want to find out, given the information you have available to you!
Why would there be an inbuilt feature for that? That's like having an inbuilt feature for detecting specific words on the keyboard. You have to code this stuff!
Your answer
Follow this Question
Related Questions
Taping in UnityIphone. URGENT! 2 Answers
Does UNity iPHOne work 1.7 work with the new iPhone 4 os? 1 Answer
Making a GUI Texture tappable on iPhone 4 Answers
BCE0019: is not a member of 'UnityEngine.Component' when trying to Build and Run iOS Unity 2 Answers
From Mouse To Iphone Touch Code 0 Answers