質問編集履歴

1

質問の追記

2018/02/16 09:10

投稿

miiichat
miiichat

スコア72

test CHANGED
File without changes
test CHANGED
@@ -83,3 +83,67 @@
83
83
 
84
84
 
85
85
  回答していただけると嬉しいです。
86
+
87
+
88
+
89
+ ###追記
90
+
91
+
92
+
93
+ ```
94
+
95
+ using System.Collections;
96
+
97
+ using System.Collections.Generic;
98
+
99
+ using UnityEngine;
100
+
101
+
102
+
103
+ public class Ball : MonoBehaviour {
104
+
105
+ public float Speed = 15.0f;
106
+
107
+
108
+
109
+ void Start () {
110
+
111
+ Rigidbody rigidbody = GetComponent<Rigidbody>();
112
+
113
+ }
114
+
115
+
116
+
117
+
118
+
119
+ void Update () {
120
+
121
+ if (Input.GetButtonUp("Jump") && rigidbody.velocity == new Vector3(0, 0, 0)){
122
+
123
+ rigidbody.AddForce((transform.forward + transform.right) * Speed, ForceMode.VelocityChange);
124
+
125
+ }
126
+
127
+ }
128
+
129
+ }
130
+
131
+ ```
132
+
133
+ ```
134
+
135
+ Assets/Ball.cs(9,20): warning CS0219: The variable `rigidbody' is assigned but its value is never used
136
+
137
+ ```
138
+
139
+ ```
140
+
141
+ Assets/Ball.cs(14,48): error CS1061: Type `UnityEngine.Component' does not contain a definition for `velocity' and no extension method `velocity' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
142
+
143
+ ```
144
+
145
+ ```
146
+
147
+ Assets/Ball.cs(15,20): error CS1061: Type `UnityEngine.Component' does not contain a definition for `AddForce' and no extension method `AddForce' of type `UnityEngine.Component' could be found. Are you missing an assembly reference?
148
+
149
+ ```