Version: 2019.2
public static bool CheckCapsule (Vector3 start, Vector3 end, float radius, int layerMask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

パラメーター

startカプセルの start にある球形の中心
endカプセルの end にある球形の中心
radiusカプセルの半径
layermask レイヤーマスク はレイキャストするときに選択的に衝突を無視するために使用します。
queryTriggerInteractionトリガーに設定されているものも検索対象にするか

説明

ワールド空間内のコライダーのいずれかがカプセル型と重なっているか。

カプセルは2つの終点である point1point2 、それらの radius からなる2つの球形で定義されます。

using UnityEngine;

public class Example : MonoBehaviour { // Given the start and end waypoints of a corridor, check if there is enough // room for an object of a certain width to pass through. bool CorridorIsWideEnough(Vector3 startPt, Vector3 endPt, float width) { return Physics.CheckCapsule(startPt, endPt, width); } }