using UnityEngine;
using System.Collections;

public class Touch_move : MonoBehaviour {
	public GameObject player;
	public Vector3 pos;
	// Use this for initialization
	void Start () {
		pos = player.transform.position;
	}
	
	// Update is called once per frame
	void Update () {


		if (Input.touchCount == 1) {

			if (Input.GetTouch (0).tapCount == 1) {

				Ray ray;
				ray = Camera.main.ScreenPointToRay (Input.GetTouch (0).position);

				RaycastHit hit;

				if(Physics.Raycast(ray,out hit)){

					print (hit.point);
					pos = hit.point;

				}



			}


		}

		player.transform.position = Vector3.MoveTowards (player.transform.position, pos, Time.deltaTime * 3);
	
	}
}
