質問編集履歴
1
Hierarchyの構成とスクリプトの追加
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,21 @@
|
|
7
7
|
具体的なコードの組み方がわからないです
|
8
8
|
どなたかお力を????♂️
|
9
9
|
|
10
|
-

|
10
|
+

|
11
|
+

|
12
|
+
|
13
|
+
```C#
|
14
|
+
using System.Collections;
|
15
|
+
using System.Collections.Generic;
|
16
|
+
using UnityEngine;
|
17
|
+
public class VRController : MonoBehaviour
|
18
|
+
{
|
19
|
+
private GameObject parent;
|
20
|
+
void Update()
|
21
|
+
{
|
22
|
+
var center = this.transform.localPosition;
|
23
|
+
// parentは親のGameObject
|
24
|
+
parent.transform.position = parent.transform.position + (this.transform.localPosition - center) * Time.deltaTime;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
```
|