Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Physics.CheckCapsule

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

닫기

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

닫기

취소

Switch to Manual
public static function CheckCapsule(start: Vector3, end: Vector3, radius: float, layermask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): bool;
public static bool CheckCapsule(Vector3 start, Vector3 end, float radius, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);
public static function CheckCapsule(start: Vector3, end: Vector3, radius: float, layermask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): bool;
public static bool CheckCapsule(Vector3 start, Vector3 end, float radius, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);
public static function CheckCapsule(start: Vector3, end: Vector3, radius: float, layermask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): bool;
public static bool CheckCapsule(Vector3 start, Vector3 end, float radius, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

파라미터

start 캡슐의 시작점에서의 구(sphere)의 중심.
end 캡슐의 끝점에서의 구(sphere)의 중심.
radius 캡슐의 반경.
layermask Layer mask는 캡슐 캐스팅을 할 때 선택적으로 콜라이더를 무시할 때에 사용됩니다.
queryTriggerInteraction Specifies whether this query should hit Triggers.

Description

Checks if any colliders overlap a capsule-shaped volume in world space.

캡슐은 두개의 구체와 point1를 둘러싸는 point1point2 두개의 끝점으로 구성되어 정의됩니다.

// 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.
function CorridorIsWideEnough(startPt: Vector3, endPt: Vector3, width: float) {
	return Physics.CheckCapsule(startPt, endPt, width);
}
using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { bool CorridorIsWideEnough(Vector3 startPt, Vector3 endPt, float width) { return Physics.CheckCapsule(startPt, endPt, width); } }