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

パラメーター

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

戻り値

int Returns the number of results placed in the results array.

説明

Casts a circle into the Scene, returning colliders that contact with it into the provided results array.

この関数は結果が配列に返されること以外は CircleCastAll 関数と同様です。返される int 値は円形と交わるオブジェクトの数です( 0 の可能性もあります)が、オブジェクトの数が配列よりも多くとも配列の長さが変わることはありません。この仕様について重要なのは、この結果からメモリ割り当てが行われないため、頻繁に実行された場合にガベージコレクションのパフォーマンスが向上するということです。

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

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