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.BoxCastAll

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 BoxCastAll(center: Vector3, halfExtents: Vector3, direction: Vector3, orientation: Quaternion = Quaternion.identity, maxDistance: float = Mathf.Infinity, layermask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): RaycastHit[];
public static RaycastHit[] BoxCastAll(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation = Quaternion.identity, float maxDistance = Mathf.Infinity, int layermask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

파라미터

center 구체의 반경.
halfExtents Half the size of the box in each dimension.
direction 스윕 테스트를 위한 구(sphere)로의 방향.
orientation Rotation of the box.
maxDistance 레이의 길이.
layermask Layer mask는 캡슐 캐스팅을 할 때 선택적으로 콜라이더를 무시할 때에 사용됩니다.
queryTriggerInteraction Specifies whether this query should hit Triggers.

Returns

RaycastHit[] All colliders that were hit.

Description

Physics.SphereCast와 같지만, 이 함수는 모든 충돌한 구체 교차들을 반환할 것입니다.

Notes: For colliders that overlap the box at the start of the sweep, the output direction is set opposite to the direction of the sweep, distance is set to zero as well as zero vector gets returned in the position field of the RaycastHit structure. You might want to check whether this is the case in your particular query and perform additional queries to refine the result.