質問編集履歴
1
ソースコード
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,13 +21,11 @@
|
|
21
21
|
public float jumpPower;
|
22
22
|
private Rigidbody rb;
|
23
23
|
private bool isJumping = false;
|
24
|
-
|
25
24
|
void Start()
|
26
25
|
{
|
27
26
|
m_rigid_body = this.GetComponent<Rigidbody>();
|
28
27
|
rb = GetComponent<Rigidbody>();
|
29
28
|
}
|
30
|
-
|
31
29
|
void Update()
|
32
30
|
{
|
33
31
|
if(Input.GetKeyDown(KeyCode.Space) && !isJumping)
|
@@ -36,7 +34,6 @@
|
|
36
34
|
isJumping = true;
|
37
35
|
}
|
38
36
|
}
|
39
|
-
|
40
37
|
// ★★追加
|
41
38
|
private void OnCollisionEnter(Collision collision)
|
42
39
|
{
|
@@ -45,7 +42,6 @@
|
|
45
42
|
isJumping = false;
|
46
43
|
}
|
47
44
|
}
|
48
|
-
|
49
45
|
// WASDで移動
|
50
46
|
void FixedUpdate()
|
51
47
|
{
|
@@ -54,7 +50,6 @@
|
|
54
50
|
if (Input.GetKey(KeyCode.A)) { direction += new Vector3(-1.0f, 0.0f, 0.0f); }
|
55
51
|
if (Input.GetKey(KeyCode.W)) { direction += new Vector3(0.0f, 0.0f, 1.0f); }
|
56
52
|
if (Input.GetKey(KeyCode.S)) { direction += new Vector3(0.0f, 0.0f, -1.0f); }
|
57
|
-
|
58
53
|
MyAddForce(direction);
|
59
54
|
}
|
60
55
|
private void MyAddForce(Vector3 direction)
|