質問編集履歴
2
追記
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
修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Physics.CheckSphere
|
1
|
+
Physics.CheckSphereで可視化したり、ヒットしたオブジェクトの情報を取得。
|
body
CHANGED
File without changes
|