- Home /
Detect swipe along 3d arrows
Hi!
How can I select one of them by swiping in the right direction. I don´t need a tested script. Just some ideas...
Thanks!!! :)
Answer by VesuvianPrime · Dec 12, 2014 at 10:36 PM
Break the problem into two parts:
1 - Calculating swipe vector
Write a class that reads touch positions to calculate the swipe vector. Take the touch start and touch end positions, project them into worldspace, subtract start from end to get the swipe vector in worldspace.
2 - Selecting a direction based on input vector
Dot the input vector with each direction. Take the dot product closest to 1 as your resulting direction.
Thanks. That helps me a lot. But how can I get the third dimension in step 1?
Your answer
Follow this Question
Related Questions
Swipe and Hold to move character . 1 Answer
Mobile Swipe Gesture to flick object in 3D space 0 Answers
mouse input to touch input help please 0 Answers
swipe movement control 1 Answer
How do you force points into a straight a line using swipe? 0 Answers