the following code translates a camera upp and down when draging up and down over the screen. It works but there is one problem, lets say I put one finger down for draging, then I put a second finger down for some other reasson. I now got to fingers touching the screen, the problem is if I release the first finger; the camera jumps quite a bit.
I think the problem lies with the GetMouseButtonDown event, but im not sure how to solve it
function Update ()
{
if (Input.GetMouseButtonDown(0) && Input.touchCount == 1)
{
firstTransformPos = (Input.mousePosition.y/Screen.height);
old = 0;
}
if(Input.GetMouseButton(0) && Input.touchCount == 1)// This keeps running while mouse is held down
{
curMousePos = (Input.mousePosition.y/Screen.height) - firstTransformPos;
transform.Translate(0, -(curMousePos-old)*10, 0);
old = curMousePos;
}
}
Does anyone have a solution or perhaps a script which does the same thing basically?
also posted here: http://forum.unity3d.com/threads/132214-My-drag-camera-script-gets-messed-up-when-changing-fingers.-Please-help!?p=892697#post892697