teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

追記

2021/07/14 05:53

投稿

kosei506
kosei506

スコア0

title CHANGED
File without changes
body CHANGED
@@ -49,4 +49,37 @@
49
49
  よろしくお願い致します。
50
50
 
51
51
  実行自体はできますが、Vector2 p2 = this.player.transform.position; が機能しておらず
52
- playerとarrowが衝突しても消滅しません。
52
+ playerとarrowが衝突しても消滅しません。
53
+
54
+ 追記
55
+ playerのscriptは
56
+
57
+ using System.Collections;
58
+ using System.Collections.Generic;
59
+ using UnityEngine;
60
+
61
+ public class PlayerController : MonoBehaviour
62
+ {
63
+ // Start is called before the first frame update
64
+ void Start()
65
+ {
66
+
67
+ }
68
+
69
+ // Update is called once per frame
70
+ void Update()
71
+ {
72
+ //左矢印が押された時
73
+ if (Input.GetKeyDown(KeyCode.LeftArrow))
74
+ {
75
+ transform.Translate(-3, 0, 0); //左に3動かす
76
+ }
77
+
78
+ if (Input.GetKeyDown(KeyCode.RightArrow))
79
+ {
80
+ transform.Translate(3, 0, 0);
81
+ }
82
+
83
+ }
84
+ }
85
+ です。

1

実行自体はできますが、Vector2 p2 = this.player.transform.position;

2021/07/14 05:53

投稿

kosei506
kosei506

スコア0

title CHANGED
File without changes
body CHANGED
@@ -44,5 +44,9 @@
44
44
  }
45
45
 
46
46
 
47
+
47
48
  です。playerは設定できていると思うのですが、関連づけができていないと言うことでしょうか?
48
- よろしくお願い致します。
49
+ よろしくお願い致します。
50
+
51
+ 実行自体はできますが、Vector2 p2 = this.player.transform.position; が機能しておらず
52
+ playerとarrowが衝突しても消滅しません。