teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2018/11/24 02:47

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -36,4 +36,40 @@
36
36
  }
37
37
  }
38
38
 
39
+ ```
40
+
41
+ ### 追記。
42
+
43
+ ```C#
44
+ using System.Collections;
45
+ using System.Collections.Generic;
46
+ using UnityEngine;
47
+
48
+ public class Sample : MonoBehaviour {
49
+
50
+ [SerializeField]
51
+ float sphereRadius = 3.0f;
52
+ Vector3 center;
53
+
54
+ // Use this for initialization
55
+ void Start () {
56
+ center = this.transform.position;
57
+ }
58
+
59
+ // Update is called once per frame
60
+ void Update () {
61
+ Collider[] hitColliders = Physics.OverlapSphere(center, sphereRadius);
62
+ int i = 0;
63
+ while (i < hitColliders.Length)
64
+ {
65
+ Debug.Log(hitColliders[i].gameObject);
66
+ i++;
67
+ }
68
+ }
69
+
70
+ void OnDrawGizmos(){
71
+ Gizmos.color = Color.yellow;
72
+ Gizmos.DrawWireSphere(center, sphereRadius);
73
+ }
74
+ }
39
75
  ```

1

修正

2018/11/24 02:47

投稿

退会済みユーザー
title CHANGED
@@ -1,1 +1,1 @@
1
- Physics.CheckSphere可視化したり、ヒットしたオブジェクトの情報取得。
1
+ Physics.CheckSphere可視化したり、ヒットしたオブジェクトの情報取得。
body CHANGED
File without changes