質問編集履歴

2

追記

2018/11/24 02:47

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -75,3 +75,75 @@
75
75
 
76
76
 
77
77
  ```
78
+
79
+
80
+
81
+ ### 追記。
82
+
83
+
84
+
85
+ ```C#
86
+
87
+ using System.Collections;
88
+
89
+ using System.Collections.Generic;
90
+
91
+ using UnityEngine;
92
+
93
+
94
+
95
+ public class Sample : MonoBehaviour {
96
+
97
+
98
+
99
+ [SerializeField]
100
+
101
+ float sphereRadius = 3.0f;
102
+
103
+ Vector3 center;
104
+
105
+
106
+
107
+ // Use this for initialization
108
+
109
+ void Start () {
110
+
111
+ center = this.transform.position;
112
+
113
+ }
114
+
115
+
116
+
117
+ // Update is called once per frame
118
+
119
+ void Update () {
120
+
121
+ Collider[] hitColliders = Physics.OverlapSphere(center, sphereRadius);
122
+
123
+ int i = 0;
124
+
125
+ while (i < hitColliders.Length)
126
+
127
+ {
128
+
129
+ Debug.Log(hitColliders[i].gameObject);
130
+
131
+ i++;
132
+
133
+ }
134
+
135
+ }
136
+
137
+
138
+
139
+ void OnDrawGizmos(){
140
+
141
+ Gizmos.color = Color.yellow;
142
+
143
+ Gizmos.DrawWireSphere(center, sphereRadius);
144
+
145
+ }
146
+
147
+ }
148
+
149
+ ```

1

修正

2018/11/24 02:47

投稿

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