单击鼠标左键 物体朝向点击点
function Update () {
var newpoint:Vector3 ;
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hit : RaycastHit;
if (Physics.Raycast (ray, hit, 100)) {
Debug.DrawLine (ray.origin, hit.point);
}
if(Input.GetKeyDown(KeyCode.Mouse0)){
newpoint =hit.point;
print(transform.position.y);
transform.LookAt(Vector3(newpoint[0],transform.position.y,newpoint[2]));
}
}