質問編集履歴
1
コピペミスをしていました。GetComponent<Rigidbody>→GetComponent<Rigidbody>()
title
CHANGED
File without changes
|
body
CHANGED
@@ -6,13 +6,13 @@
|
|
6
6
|
3Dの「Rigidbody」では、以下の書き方でオブジェクトの動きを止められると思います。
|
7
7
|
|
8
8
|
```C#
|
9
|
-
player.GetComponent<Rigidbody>.velocity = Vector3.zero;
|
9
|
+
player.GetComponent<Rigidbody>().velocity = Vector3.zero;
|
10
10
|
```
|
11
11
|
|
12
12
|
2Dを使用する場合も、同じやり方でできると思い、以下の書き方で試しましたが、うまくいきませんでした。
|
13
13
|
|
14
14
|
```C#
|
15
|
-
player.GetComponent<Rigidbody2D>.velocity = Vector3.zero;
|
15
|
+
player.GetComponent<Rigidbody2D>().velocity = Vector3.zero;
|
16
16
|
//(playerオブジェクトにRigidbody2Dをアタッチしております)
|
17
17
|
```
|
18
18
|
|