- Home /
This question was
closed May 11, 2013 at 07:59 AM by
Fattie for the following reason:
Duplicate Question
How to setup camera look at mouse on right click
I have a script started to get my camera location and me mouse location on the terrain but I am not sure how to make the camera look at the mouse when i right click any ideas on how I would do this smoothly so the camera pans over to center on what you clicked?
function Update () {
var hit : RaycastHit;
if(Input.GetMouseButton(1)) {
var ray : Ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if(Physics.Raycast(ray, hit))
Debug.Log("Mouse Location " + hit.point);
Debug.Log("camera Location " + Camera.mainCamera.gameObject.transform.position);
}
}
Comment