- Home /
Other
Samsung Swipe and Touch
I am having trouble understanding swipe and touch input for unity. I have search a lot but I can't find anything that I can understand. Any help is much appreciated.
I'm trying to help but need to understand what the issue is first. $$anonymous$$aybe you can help me understand what part of it seems like a bit of work?
I ask because you can detect when a touch first happens and when it releases. Given this, you can deter$$anonymous$$e the distance between the two events and divide by the screen width to figure out how far they moved in relation to the resolution.
Please don't post comments as answers. Answer means solution and not reply. Your comments are also not moderated and appear immediately. I have converted it on this occasion.
What i need is to have a button, that you can press @nazia08 . im making a game where you press an up or down arrow to jump or duck. thanks!
Answer by hahasoftware · Mar 08, 2014 at 10:04 AM
Have you tried looking at the unity documentation to get a basic idea of what is going on? For the most part touch is equal to mouse clicks (its easier to think about it like this) as long as you are only thinking about one touch. Since its possible to do multiple touches/fingers at once unity uses an array to hold the touch's. If you are just looking for example code on how to handle something like swipes then maybe try out this link http://forum.unity3d.com/threads/48601-Swipe-help-please?highlight=swipe The 4th post down helped me get swipes working in my code. I find that just pasting random code in and playing around with it until i see what everything does usually helps. Anything I don't understand at all I just lookup in the documentation or google for some extra help.
Follow this Question
Related Questions
Move object using swipe control for mobile 2 Answers
Swipe controls error "Cannot implicitly convert type 'UnityEngine.Touch' to 'Touch' " 1 Answer
Swipe and Joystick Together on Mobile 0 Answers
How to accept swipe input when already touching with one finger. 0 Answers
mouse input to touch input help please 0 Answers