📜  来自鼠标位置的统一射线 - C# 代码示例

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

代码示例1
RaycastHit hit;
Ray ray = camera.ScreenPointToRay(Input.mousePosition);

if (Physics.Raycast(ray, out hit)) {
  Transform objectHit = hit.transform;

  // Do something with the object that was hit by the raycast.
}