Perspective camera touch movement

Hi

I have a problem configuring movement of camera with touch input. I found a script on the forums that should do the job but the problem is that camera wont move over z axis. It is perspective camera so I want it just to be moved over x and z axis for purpose of kinda rts like game.

So when I move finger on the touch screen in x axis direction it works but y axis is constantly 0. I cant see where this problem occurs and why. I also need to put that y axis movement on touch screen to z axis transform of camera.

This is the code I found:

void Update () 
 {
    if (Input.touchCount == 1) {
    Touch currentTouch = Input.GetTouch(0);

    if (currentTouch.phase == TouchPhase.Began) {
        this.worldStartPoint = this.getWorldPoint(currentTouch.position);
            }

    if (currentTouch.phase == TouchPhase.Moved) {
                Vector2 worldDelta = this.getWorldPoint(currentTouch.position) - this.worldStartPoint;
                Camera.main.transform.Translate( -worldDelta.x, 0, -worldDelta.y );
         }
    }
}

    private Vector2 getWorldPoint(Vector2 screenPoint)
    {
        RaycastHit hit;
        Physics.Raycast(Camera.main.ScreenPointToRay(screenPoint), out hit);
        return hit.point;
     }

Where is your worldStartPoint variable? How did you define it? Also, I think the translate should be on x and z, not x and y.

you should specify that it moves on World space and not taking your local coordinates

Camera.main.transform.Translate(-worldDelta.x, 0, -worldDelta.y,Space.World);