Created
May 7, 2019 13:32
-
-
Save nopitech/167d1083c593b9d80a24ee813de145cc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Update() | |
{ | |
// クリックした位置へのレイ取得 | |
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit; | |
// クリックしたら | |
if (Input.GetMouseButtonDown(0)) | |
{ | |
// レイ飛ばす | |
if (Physics.Raycast(ray, out hit, 100f)) | |
{ | |
Debug.Log(hit.collider.name); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment