-
Hit
RaycastHit hit; Ray ray = mCam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit)) { Transform hitobj = hit.transform; Debug.Log("hit x:" + hit.point.x + " y:" + hit.point.y + " z:" + hit.point.z); Debug.Log("obj n:" + hitobj.name + " x:" + hitobj.position.x + " y:" + hitobj.position.y + " z:" + hitobj.position.z); }
'Unity' 카테고리의 다른 글
Unity - Rigidbody.AddForce (0) 2021.03.20 Unity - singleton pattern (static, global) (0) 2021.03.20 Unity - Mouse (object event) (0) 2021.03.20 Unity - 3d object drag (0) 2021.03.20 Unity - Translate (0) 2021.03.18 Unity - Mouse (Input class) (0) 2021.03.18 Unity - Material (0) 2021.03.18 Unity - instantiate (GameObject 생성 함수) (0) 2020.11.17