- Home /
This question was
closed Apr 01, 2015 at 02:13 PM by
hug0 for the following reason:
The question is answered, right answer was accepted
This post has been wikified, any user with enough reputation can edit it.
Question by
hug0 · Aug 22, 2013 at 03:31 PM ·
androidjavascripttouch
Unity touch
I would like to know how to detect a long touch.
So far my code like this:
var car : Rigidbody;
var touchTime: float;
if (Input.touchCount == 1){
touchTime = Time.time;
var touch = Input.touches[0];
car.MovePosition(car.position + speed1up * Time.deltaTime);
if (Time.time-touchTime > 1){
car.MoveRotation(rigidbody.rotation * deltaRotation);
}
}
Thanks!
Comment
Best Answer
Answer by meat5000 · Aug 22, 2013 at 03:35 PM
Use your touch phases, Begin, moved etc and incorporate a timer
http://answers.unity3d.com/questions/61247/holding-a-touch-down-on-the-iphone.html (Havent really checked the page but itll point you in the right direction)
timer += Time.deltaTime;
Thanks for the vote. Please click accepted answer if it is The One :)
Follow this Question
Related Questions
Disable gui texture in a different way? 0 Answers
Android touch question 0 Answers
Android touch is not dynamic 1 Answer
android touch input 1 Answer
Unity 2D Mobile Game Drawing Mechanic 0 Answers