Created
May 7, 2019 13:37
-
-
Save nopitech/7fae40b0bc8a1e8282416bc27c307cd6 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
RaycastHit hit; | |
void Update() | |
{ | |
Ray ray = new Ray(transform.position, transform.TransformDirection(Vector3.up)); | |
// レイ飛ばす | |
if (Physics.SphereCast(ray, 1f, out hit, 100f)) | |
{ | |
Debug.Log(hit.collider.gameObject.name); | |
} | |
} | |
// 表示(シーンビューのみ) | |
void OnDrawGizmosSelected() | |
{ | |
Gizmos.DrawWireSphere(hit.point, 1f); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment