- Home /
Swipe gesture?
Hello. How can I detect the swipe gesture (I want to copy the system apple uses for deleting messages, songs, etc.)? Thanks
Answer by kromenak · Oct 08, 2011 at 07:29 AM
You can detect a swipe by recording the position of a touch from frame to frame using Update.
Using the touch position on the current frame and the touch position on the previous frame, you should be able to calculate a touch "velocity". You can then determine what velocity is going to be sufficient to call it a swipe. You can then determine different direction swipes depending on the x/y values of the position change.
In fact, a Touch has properties called deltaPosition and deltaTime that could be used to calculate this easily. touchVelocity = deltaPosition / deltaTime!
Your answer
Follow this Question
Related Questions
Help with jump 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Rotating an object on swipe (Quaternions??) 1 Answer
Recommendations on best way to begin implementing Swipe for iOS game? 1 Answer
Touch Controls 0 Answers