Trace Specific Movement of Finger

Hello. I am very new to Unity, but I have some programming experience in Java and other languages. I am trying to make a game for Android (and maybe iOS and Vita?) where you would have to trace the shape that shows on screen in order to score. The problem is, I do not know how to allow the game to detect a certain trace of the finger, and determine if it is correct and incorrect.

For example, say a triangle shows on the screen. They would have to trace that triangle in order to score. If correct, they score. If not, they lose a life. How can I have the game know that they need to trace that shape, and follow their finger and record the trace? Sorry if this does not sound like a good post, but I have just started using Unity very recently.

Interesting question :slight_smile:

I do not know how you would trace exactly – I might, if I ever tried this, setup a number of points along the shape that must be ‘hit’ in order to complete the trace (eg: hit all … x number of points, they probably traced it.) How you’d setup points may be another topic… Could be the event system with OnPointerEnter or something.

Maybe someone else will have other ideas :slight_smile: Sorry I couldn’t be more help. Curious to see what comes of this .

One way I’ve done this in the past is to do something similar to what @methos5k said. You lay out a shape, and I had colliders that cannot be exited in order to make an accurate-enough shape. The collider size determines the level of accuracy necessary. If the player’s finger leaves the designated colliders, you know they failed to trace the shape.

To append to my previous response, I admit that I glossed over the “failing” part a little bit, and was more focused on “must complete the trace to pass”. Failing to trace? … lol Anyways, jeffrey’s response is a bit more accurate on that matter :slight_smile: