Version: 2017.3
public static RaycastHit2D[] CircleCastAll (Vector2 origin, float radius, Vector2 direction, float distance= Mathf.Infinity, int layerMask= DefaultRaycastLayers, float minDepth= -Mathf.Infinity, float maxDepth= Mathf.Infinity);

パラメーター

origin The point in 2D space where the circle originates.
radius 円の半径
direction Vector representing the direction of the circle.
distance Maximum distance over which to cast the circle.
layerMask 特定のレイヤーのコライダーのみを判別するためのフィルター
minDepth この値以上の Z 座標(深度)を持つオブジェクトのみを含みます。
maxDepth この値以下の Z 座標(深度)を持つオブジェクトのみを含みます。

戻り値

RaycastHit2D[] 投げかけた結果が返されます。

説明

シーン上のコライダーに円を投げかけ、接触したすべてのコライダーを返します。

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.

この関数は CircleCast と似ていますが、ヒットした最初のコライダーを検知する代わりに、円の軌道に沿った全コライダーの配列が返されます。配列のコライダー原点からの距離で整理されます。 layerMask は特定のレイヤー上にあるオブジェクトのみを選択的に検知するのに使えます(これにより例えば、敵キャラクターのみ検知するといった使い方ができます)。

返される RaycastHit2D は円形がコライダーに触れる場所の点と法線両方の情報を持ちます。また、その点に接触するために円が位置するであろう重心も返します。

関連項目: LayerMask クラス、RaycastHit2D クラス、CircleCastCircleCastNonAllocDefaultRaycastLayersIgnoreRaycastLayerraycastsHitTriggers.