using UnityEngine;
using System.Collections;
public class mouse_WT : MonoBehaviour {
public Vector3 end;
// Use this for initialization
void Start () {
end=transform.position;
}
// Update is called once per frame
void Update () {
if(Input.GetMouseButtonDown(0))
{
//定义一个射线 摄像头到物体之间的。
Ray ray=Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if(Physics.Raycast(ray,out hit))
{
end=hit.point;
}
}
//插值;
transform.position=Vector3.Lerp(transform.position,end,Time.deltaTime*2.0f);
}
}