回答編集履歴
1
Carからコンポーネントを取る形になっていなかったため修正
answer
CHANGED
@@ -16,14 +16,14 @@
|
|
16
16
|
float point_z = 20.0f;
|
17
17
|
|
18
18
|
CarUserControl carUserControl;
|
19
|
-
CarController
|
19
|
+
CarController carController;
|
20
20
|
|
21
21
|
// Start is called before the first frame update
|
22
22
|
void Start()
|
23
23
|
{
|
24
24
|
Car = GameObject.Find("Car");
|
25
|
-
carUserControl = GetComponent<CarUserControl>();
|
25
|
+
carUserControl = Car.GetComponent<CarUserControl>();
|
26
|
-
|
26
|
+
carController = Car.GetComponent<CarController>();
|
27
27
|
}
|
28
28
|
|
29
29
|
// Update is called once per frame
|
@@ -44,7 +44,7 @@
|
|
44
44
|
{
|
45
45
|
// ハンドブレーキを引きっぱなしにし、入力はハンドル操作のみ受け付ける
|
46
46
|
float h = CrossPlatformInputManager.GetAxis("Horizontal");
|
47
|
-
|
47
|
+
carController.Move(h, 0.0f, 0.0f, 1.0f);
|
48
48
|
}
|
49
49
|
}
|
50
50
|
}
|