質問編集履歴

1

Hierarchyの構成とスクリプトの追加

2020/01/20 07:05

投稿

atsushi3105
atsushi3105

スコア8

test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,37 @@
17
17
 
18
18
 
19
19
  ![イメージ説明](398260e923993c3df97c1d7a11c55edc.jpeg)
20
+
21
+ ![イメージ説明](02196c47cf2acb04d0f3aa9399ecc864.png)
22
+
23
+
24
+
25
+ ```C#
26
+
27
+ using System.Collections;
28
+
29
+ using System.Collections.Generic;
30
+
31
+ using UnityEngine;
32
+
33
+ public class VRController : MonoBehaviour
34
+
35
+ {
36
+
37
+ private GameObject parent;
38
+
39
+ void Update()
40
+
41
+ {
42
+
43
+ var center = this.transform.localPosition;
44
+
45
+ // parentは親のGameObject
46
+
47
+ parent.transform.position = parent.transform.position + (this.transform.localPosition - center) * Time.deltaTime;
48
+
49
+ }
50
+
51
+ }
52
+
53
+ ```