- Home /
Mobile touch input conflicts
Hi, I'm developing a game to mobile where the user can move the camera with a PanGesture (moving the finger on the screen) and also there are 3d objects that are clickable in the scene. I'm trying to wrap my head around how am i suppose to differentiate between the two gestures. For example if the user starts to pan the camera on-top of the clickable 3d object, i don't want the object to be clicked. Thanks! :)
Answer by Casiell · Nov 05, 2018 at 09:41 AM
Ok, so there are probably many ways to tackle this with different results, so here is one of them.
Click should be registered only after user lifts the finger. So when you touch the object you store touch position. Then, when player eventually lifts his finger, you check if position distance is less than some small value. If it is, then it was a valid click, else you do nothing (you pan the camera I guess, but do nothing with clickable object).
You can also check the distance all the time. With previous solution you could move your finger as much as you want as long as final position would be the same. If you check the distance constantly you can find out that click is not valid as soon as player moves finger away from your object
Your answer
Follow this Question
Related Questions
Dragging Camera based on Touch 0 Answers
Delta touch trembling 0 Answers
How to rotate the camera with twist gesture 0 Answers
Help with camera movement using mobile input 0 Answers
IOS Touch movement not exiting coroutine 0 Answers