📜  3d 鼠标 raycast 对象命中名称 - 任何代码示例

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

代码示例1
if ( Input.GetMouseButtonDown (0)){ 
   RaycastHit hit; 
   Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); 
   if ( Physics.Raycast (ray,out hit,100.0f)) {
     StartCoroutine(ScaleMe(hit.transform));
     Debug.Log("You selected the " + hit.transform.name); // ensure you picked right object
   }
 }