質問編集履歴
10
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
9
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
8
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
7
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
6
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
5
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
4
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
3
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
2
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,17 +1,41 @@
|
|
1
|
+
既にinstantiateで生成された複数のobjを
|
2
|
+
|
3
|
+
Findで取得し、positionをrandom.rangeで移動させ
|
4
|
+
|
1
|
-
|
5
|
+
取得したオブジェクトは個々をRandom.Rangeで移動させたいのですが
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
下記で実装したところ、 取得したオブジェクトはRandom.Rangeで移動することは
|
10
|
+
|
11
|
+
できたのですが、一箇所に固まってしまいます。
|
12
|
+
|
13
|
+
複数のobjを別々に移動させる方法はありますでしょうか
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
float x;
|
18
|
+
|
19
|
+
float y;
|
20
|
+
|
21
|
+
float z;
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
x = Random.Range (-200.0f, 200.0f);
|
26
|
+
|
27
|
+
y = Random.Range (-200.0f, 200.0f);
|
28
|
+
|
29
|
+
z = Random.Range (-200.0f, 200.0f);
|
2
30
|
|
3
31
|
|
4
32
|
|
5
33
|
|
6
34
|
|
7
|
-
|
35
|
+
aa= GameObject.FindGameObjectsWithTag("obj");
|
8
36
|
|
9
|
-
ra
|
37
|
+
foreach (GameObject tt in aa)
|
10
38
|
|
11
39
|
|
12
40
|
|
13
|
-
|
14
|
-
|
15
|
-
|
41
|
+
tt.transform.position=new Vector3(x,y,z);
|
16
|
-
|
17
|
-
ありますでしょうか
|