Skip to content

Instantly share code, notes, and snippets.

@nopitech
Created May 7, 2019 13:36
Show Gist options
  • Save nopitech/e5d43200c92ab1f1fab9776a97d85fb2 to your computer and use it in GitHub Desktop.
Save nopitech/e5d43200c92ab1f1fab9776a97d85fb2 to your computer and use it in GitHub Desktop.
RaycastHit hit;
void Update()
{
// レイ飛ばす
if (Physics.BoxCast(transform.position, Vector3.one * 0.5f, transform.TransformDirection(Vector3.up), out hit))
{
Debug.Log(hit.collider.gameObject.name);
}
}
// 表示(シーンビューのみ)
void OnDrawGizmosSelected()
{
Gizmos.DrawWireCube(hit.point, Vector3.one * 0.5f);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment