origin | The point in 2D space where the circle originates. |
radius | 円の半径 |
direction | A vector representing the direction of the circle. |
distance | The maximum distance over which to cast the circle. |
layerMask | 特定のレイヤーのコライダーのみを判別するためのフィルター |
minDepth | この値以上の Z 座標(深度)を持つオブジェクトのみを含みます。 |
maxDepth | この値以下の Z 座標(深度)を持つオブジェクトのみを含みます。 |
RaycastHit2D 投げかけた結果が返されます。
Casts a circle against colliders in the Scene, returning the first collider to contact with it.
A CircleCast is conceptually like dragging a circle through the Scene in a particular direction. Any object making contact with the circle can be detected and reported.
この関数は RaycastHit2D オブジェクトと、ボックスに接触したコライダーに対する参照を返します(コライダープロパティーは、何も接触していない場合は null を返します)。layerMask により、特定のレイヤーのオブジェクトのみを選択的に検出することができます。(これにより、例えば敵キャラクターのみを検出するということなどができます)
返される RaycastHit2D は円形がコライダーに触れる場所の点と法線両方の情報を持ちます。また、その点に接触するために円が位置するであろう重心も返します。
関連項目: LayerMask クラス、RaycastHit2D クラス、:CircleCastAll、CircleCastNonAlloc、DefaultRaycastLayers、IgnoreRaycastLayer、raycastsHitTriggers.
origin | The point in 2D space where the circle originates. |
radius | 円の半径 |
direction | A vector representing the direction of the circle. |
contactFilter | The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle. |
results | The array to receive results. The size of the array determines the maximum number of results that can be returned. |
distance | The maximum distance over which to cast the circle. |
int
Returns the number of results placed in the results
array.
Casts a circle against colliders in the Scene, returning all colliders that contact with it.
A CircleCast is conceptually like dragging a circle through the Scene in a particular direction. Any collider making contact with the circle can be detected and reported.
This function returns the number of contacts found and places those contacts in the results
array. The results can also be filtered by the contactFilter
.
See Also: ContactFilter2D and RaycastHit2D.
origin | The point in 2D space where the circle originates. |
radius | 円の半径 |
direction | A vector representing the direction of the circle. |
contactFilter | The contact filter used to filter the results differently, such as by layer mask, Z depth, or normal angle. |
results | The list to receive results. |
distance | The maximum distance over which to cast the circle. |
void
Returns the number of results placed in the results
list.
Casts a circle against Colliders in the Scene, returning all Colliders that contact with it.
A CircleCast is conceptually like dragging a circle through the Scene in a particular direction. Any Collider making contact with the circle can be detected and reported.
The integer return value is the number of results written into the results
list. The results list will be resized if it doesn't contain enough elements to report all the results. This prevents memory from being allocated for results when the results
list does not need to be resized, and improves garbage collection performance when the query is performed frequently.
The results can also be filtered by the contactFilter
.
See Also: ContactFilter2D and RaycastHit2D.