📜  从相机到鼠标统一的光线投射 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:17.185000             🧑  作者: Mango

代码示例1
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out RaycastHit hit, 100)) {
    Debug.Log(hit.transform.name);
    Debug.Log("hit");
}