| start | 胶囊体在 start处的球体中心。 | 
| end | 胶囊体在 end处的球体中心。 | 
| radius | 胶囊体的半径。 | 
| layermask | 层遮罩,用于在投射胶囊体时有选择地忽略碰撞体。 | 
| queryTriggerInteraction | 指定该查询是否应该命中触发器。 | 
检查是否有任何碰撞体与世界空间中的胶囊形体积重叠。
胶囊体由中心位于 point1 和 radius、半径为 radius 的两个球体界定,两个球体构成胶囊体的两个末端。
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); } }