Hello, this question is quite similar to the existed questions we can serach, I have searched for many related answers, but I am still stuck.
This question is something different from others.
I have a fixed plane, plane will never change its position,it look like a map. Also there is a camera in the top view, i want to click on the plane and drag to other position. In this drag process, i want the point i click on is follow the mouse move.
I want only the camera to move, not the plane.
ps: now, i already know how to get the coordinate of point which i touch on the screen by using following code
cube=GameObject.Find("Cube");
Vector3 startpos=new Vector3();
if (Input.GetMouseButtonDown(0)){ // if click...
// create a logical plane perpendicular to Y and at Y=0:
Plane horPlane = new Plane(Vector3.up, Vector3.zero);
// get the ray from the camera...
Ray ray =Camera.main.ScreenPointToRay(Input.mousePosition);
print("mouseposition="+Input.mousePosition);
startpos=Input.mousePosition;
float distance1 =0;
// if the ray intersects the logical plane...
if (horPlane.Raycast(ray, out distance1)){
cube.transform.position = ray.GetPoint(distance1);
print("cube position="+cube.transform.position);
the effect i want is look like a map.
Thanks in advance!!