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

回答編集履歴

1

コードから無駄な個所を削除

2017/06/29 14:23

投稿

sushipachi
sushipachi

スコア23

answer CHANGED
@@ -17,25 +17,8 @@
17
17
  rb = GetComponent<Rigidbody>();
18
18
  }
19
19
 
20
- // Update is called once per frame
21
20
  void Update()
22
21
  {
23
- if (Input.GetKey(KeyCode.W))
24
- {
25
- transform.GetComponent<Rigidbody>().AddForce(0, 0, 5);
26
- }
27
- if (Input.GetKey(KeyCode.S))
28
- {
29
- transform.GetComponent<Rigidbody>().AddForce(0, 0, -5);
30
- }
31
- if (Input.GetKey(KeyCode.D))
32
- {
33
- transform.GetComponent<Rigidbody>().AddForce(5, 0, 0);
34
- }
35
- if (Input.GetKey(KeyCode.A))
36
- {
37
- transform.GetComponent<Rigidbody>().AddForce(-5, 0, 0);
38
- }
39
22
  if (Input.GetKey(KeyCode.F))
40
23
  {
41
24
  rb.isKinematic = true;