- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
 
- 纳金币
- -1
- 精华
- 11
|
using UnityEngine;
using System.Collections;
public class Lu : MonoBehaviour
{
public Camera cam;
// We need to actually hit an object
RaycastHit hitt = new RaycastHit();
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
Ray ray = cam.ScreenPointToRay(Input.mousePosition);
Physics.Raycast(ray, out hitt, 100);
// Debug.DrawLine(cam.transform.position, ray.direction,Color.red);
if (null != hitt.transform)
{
print(hitt.point);//鼠标点击的坐标
}
}
} |
|