BoxCastAll(Vector3, Vector3, Vector3, Quaternion, float, int, QueryTriggerInteraction)
Like Physics.BoxCast, but returns all hits.
Read time 1 minuteLast updated 6 days ago
Definition
- Type: Method
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
public static RaycastHit[] BoxCastAll(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
Parameters
Center of the box.
Half the size of the box in each dimension.
The direction in which to cast the box.
Rotation of the box.
The max length of the cast.
Specifies whether this query should hit Triggers.
Returns
Type | Description |
|---|---|
| RaycastHit[] | All colliders that were hit. |
Remarks
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.