Detecting sequential touch positions?

Hey there. How can I detect if the player moves their touch input from point A, to B, to C without lifting their finger up? To put it in context, I want to do something similar to to this (at 0:15 to 0:43). There is a sin like curve moving left to right across the screen and the player how to move their input up and down to stay on the curve. Thanks

Well,
I would suggest that the curve is an object which can register touch. If you are not touching it… You are not touching it!

By using a mesh collider? I thought of that, but I was told it was not a good idea.

It’s probably easier to create a simple sphere collider, and move it up and down with the sin wave, at the position the user is supposed to touch.

I would check to see if the player is touching the collider by using a raycast from the touch.position?

It depends on what you want to do.
Going on what i think they are doing in the video…

They want to have a touch follow the line.
I imagine that if the player removes his finger touch from the line’s area,yhat he is disqualified, for lack of a better term.

You could…
Create amcollider that will act as the line.
Then you could either do a raycast from touch,
If touching line good.
If not… Foul.

Or place a second collider object at touch pos
If collid touching line, great.
If not… Foul.

Okay. The second option sounds easy. How do I derive a Vector3 from Touch.Positon? if I remember correctly, Touch.Position returns a vector2 based on the pixel that the touch began at (so the bottom left corner is (0,0) moving to the right a bit is (100,0) etc.)…or am I completely wrong?

[your camera].ScreenToWorldPoint([screen point]);

and make sure you set the z var to the distance between your gameobject and the camera.

Is this anywhere near complete (I havent been able to test it)

var test_for_collision : gameObject;
var spawned_object : gameObject;	
var Touch_Position 	:Vector2;
var Spawn_Position	:Vector3;

function Update(){
	Touch_Position=Touch.position;
	Spawn_Position=camera.ScreenToWorldPoint (Vector3 (Touch_Position.x,Touch_Position.y,10));
	if(TouchPhase.Began==true){Invoke("Spawn",0);}
	if(TouchPhase.Ended==true){Destroy(spawned_object,0);}
	spawned_object.position=Spawn_Position;
}

function Spawn(){
	spawned_object= Instantiate (test_for_collision, Spawn_Position, Quaternion.identity);
}

I have also been thinking about a different (and potentially more accurate) way of doing this. I would use WorldToScreen point to spawn and move a GUI button directly over the object(which would be moving up and down to give the illusion that the player is scrolling along a curve). Then, when the player holds the button down I would return “in_the_line” as true…is that a good idea?

Don’t instantiate and destroy, if you use always the same object just activate and deactivate.
If you need to follow a path with your finger just use a meshcollider or a bunch of primitive collider and raycast against them.