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

質問編集履歴

2

試したこと追記

2018/02/11 07:02

投稿

yrema
yrema

スコア287

title CHANGED
File without changes
body CHANGED
@@ -15,4 +15,11 @@
15
15
  PolygonCollider2D pc2d = col.transform.GetComponent<PolygonCollider2D>();
16
16
  pc2d.sharedMaterial.bounciness = 0;
17
17
  }
18
+ ```
19
+ 以下のようにすると read-only だとエラーが出てしまいました。
20
+ ```c#
21
+ void OnCollisionEnter2D(Collision2D col) {
22
+ PolygonCollider2D pc2d = col.transform.GetComponent<PolygonCollider2D>();
23
+ pc2d.bounciness = 0f;
24
+ }
18
25
  ```

1

試したことを追記

2018/02/11 07:02

投稿

yrema
yrema

スコア287

title CHANGED
File without changes
body CHANGED
@@ -6,4 +6,13 @@
6
6
  bouncinessの変更は可能でしょうか?
7
7
 
8
8
  ◆環境
9
- Unity2017.3.1f1
9
+ Unity2017.3.1f1
10
+
11
+ ◆追記:試したこと
12
+ 以下のように0にしてみましたが、跳ね返り続けるので恐らく変わってなさそうです。
13
+ ```c#
14
+ void OnCollisionEnter2D(Collision2D col) {
15
+ PolygonCollider2D pc2d = col.transform.GetComponent<PolygonCollider2D>();
16
+ pc2d.sharedMaterial.bounciness = 0;
17
+ }
18
+ ```