박스로 캐스팅을 하는 것이고 인자 중 maxDistance 를 보면 알 수 있듯이 박스를 최대 던지는 거리(캐스팅 거리)가 있다는 것을 알 수 있습니다


인자 중 layermask 마스크 인자는 캐스팅(픽킹) 하고 싶은 레이어만을 선택 할 수 있습니다


All 은 모든 충돌체 박스 캐스팅 충돌체에 의한





충돌 범위는 center + halfExtention  ~   maxDistance + halfExtention 범위까지 체크됩니다





 



public static RaycastHit[] BoxCastAll(Vector3 centerVector3 halfExtentsVector3 directionQuaternion orientation = Quaternion.identity, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

Parameters

centerCenter of the box.
halfExtentsHalf the size of the box in each dimension.
directionThe direction in which to cast the box.
orientationRotation of the box.
maxDistanceThe max length of the cast.
layermaskLayer mask that is used to selectively ignore colliders when casting a capsule.
queryTriggerInteractionSpecifies whether this query should hit Triggers.

Returns

RaycastHit[] All colliders that were hit.

Description

Like Physics.BoxCast, but returns all hits.

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


ref : https://docs.unity3d.com/ScriptReference/Physics.BoxCastAll.html


반응형

+ Recent posts