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

Script language

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


Suggest a change


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 CapsuleCastNonAlloc(point1: Vector3, point2: Vector3, radius: float, direction: Vector3, results: RaycastHit[], maxDistance: float = Mathf.Infinity, layermask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): int;
public static int CapsuleCastNonAlloc(Vector3 point1, Vector3 point2, float radius, Vector3 direction, RaycastHit[] results, float maxDistance = Mathf.Infinity, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);


point1 캡슐의 시작점에서의 구(sphere)의 중심.
point2 캡슐의 끝점에서의 구(sphere)의 중심.
radius 캡슐의 반경.
direction 캡슐을 스윕(sweep) 테스트하기 위한 방향.
results The buffer to store the hits into.
maxDistance sweep의 길이.
layermask Layer mask는 캡슐 캐스팅을 할 때 선택적으로 콜라이더를 무시할 때에 사용됩니다.
queryTriggerInteraction Specifies whether this query should hit Triggers.


int The amount of hits stored into the buffer.


Scene안의 모든 캡슐 콜라이더에 대한 레이 캐스트를 통해 무엇과 충돌했는지 상세화된 정보를 반환합니다.

Like Physics.CapsuleCastAll, but generates no garbage.