how to drag an object in 3d world with finger

Hi,

I am working on unity now and I want to drag a cube with my finger on the mobile device like tablet. Now I can drag the cube using raycast but the cube only move in 2d world, only the x, y coordination changes, I want to be able to drag the cube in 3d world, wish all the x, y, z axis can change. Thank you.

if(Input.touchCount == 1)
		{
		   Touch touch = Input.GetTouch(0);		
		   ray = Camera.main.ScreenPointToRay(touch.position);	
		   LayerMask layerMask = 1 << 9;
		   if(Physics.Raycast(ray,out hit,100,layerMask)&&Input.GetTouch(0).phase == TouchPhase.Moved)
		   {
			  
				//probe = hit.transform;  
				hitObjects = hit.transform;
				isHit = true;
				hit.transform.Translate(Input.GetTouch(0).deltaPosition*Time.deltaTime);
				//hit.transform.position = touch.deltaPosition*0.2f;
				  //hit.transform.position += Input.GetTouch(0).deltaPosition*0.02f;			  
		   }
		}

I would find the object’s Viewport space coords (Camera.main.WorldToViewport()), move it in viewport coords, then convert that back to world coords (Camera.main.ViewportToScreen()). Keep the same Z value, just alter x,y, so the object moves in the plane that is z units from the camera, no matter which way the camera is looking.