Capsule Collider 2D は、2D 物理システムと相互作用するコライダーです。カプセルの形状は、頂点の角がなく、連続した円形の円周を持っています。この形状により、Capsule Collider 2D は他のコライダーの角に引っかかりにくくなっています。カプセル形状は空ではなく固体とみなされるため、Capsule Collider 2D の内側にある他の Collider 2D はコライダーに接触しているとみなされ、経時的にコライダーから強制的に追い出されます。
プロパティ | 機能 |
---|---|
Material | Capsule Collider 2D の使用する物理マテリアルを設定します。この設定は、全てのリジッドボディ 2D やグローバル物理コライダーをオーバーライドします。 |
Is Trigger | Capsule Collider 2D にイベントをトリガーさせたい場合はオンにしてください。このボックスをオンにすると、物理エンジンはこのコライダーを無視します。 |
Used by Effector | 添付された エフェクターのどれかがこの Capsule Collider 2D を使用する場合はオンにしてください。 |
Offset | Capsule Collider 2D ジオメトリのローカルのオフセットを設定します。 |
Size | ボックスのサイズを指定できます。その Capsule Collider 2D によって占められる領域を定義します。 |
Direction | Vertical または Horizontal に設定してください。カプセルの向く方向を設定するものです。具体的には、半円形の両端の向く方向を定義します。 |
Capsule Collider 2D を定義する設定は、Size と Direction です。Size と Direction の両プロパティは、Capsule Collider 2D のローカル空間の X と Y (それぞれ水平と垂直) を指しており、ワールド空間ではありません。
Capsule Collider 2D の設定方法として代表的なのは、Size を Direction に合わせる方法です。例えば、 Capsule Collider 2D の Direction が Vertical であれば、 X の Size は 0.5、 Y の Size は 1 です。これにより、この垂直方向のカプセルは、(太くなるのではなく) 背が高くなります。
下記の例で、黄色い線で表されているのが X と Y です。
Capsule Collider 2D の形状は様々に調整できます。以下で、以下はその一部です。
Size プロパティの X ** と Y** が同じである場合は常に、 Capsule Collider 2D はほぼ円形になります。
ノート: 2D 物理システムの既知の問題として、ゲームオブジェクトが複数のコライダーを横切って移動すると、1 つまたは複数のコライダーがコライダー同士の衝突を登録することがあります。これは、コライダーが完全に整列している場合でも発生します。この衝突により、コライダーの速度が低下したり、停止したりする場合があります。
Capsule Collider 2D を使ってサーフェスを作成すると、この問題を軽減することができます。サーフェイスに複数のコライダーを使用するのではなく、1 つのコライダーを使用することをお勧めします。Edge Collider 2D はその例です。
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.