# BoxCastAll(Vector3, Vector3, Vector3, Quaternion, float, int, QueryTriggerInteraction)

> Like Physics.BoxCast, but returns all hits.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine](/engine/6000.0/script-reference/unityengine.md)
* **Assembly:** UnityEngine.PhysicsModule

```csharp
public static RaycastHit[] BoxCastAll(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion orientation, float maxDistance, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): Center of the box.**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): Half the size of the box in each dimension.**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): The direction in which to cast the box.**** (\[Quaternion]\(/engine/6000.0/script-reference/unityengine/quaternion)): Rotation of the box.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The max length of the cast.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): **** (\[QueryTriggerInteraction]\(/engine/6000.0/script-reference/unityengine/querytriggerinteraction)): Specifies whether this query should hit Triggers.

### Returns

| Type                                                                        | Description                  |
| --------------------------------------------------------------------------- | ---------------------------- |
| [RaycastHit\[\]](/engine/6000.0/script-reference/unityengine/raycasthit.md) | All colliders that were hit. |

### Remarks

**Notes:** For colliders that overlap the box at the start of the sweep,  [RaycastHit.normal](/engine/6000.0/script-reference/unityengine/raycasthit/normal.md) is set opposite to the direction of the sweep, [RaycastHit.distance](/engine/6000.0/script-reference/unityengine/raycasthit/distance.md) is set to zero, and the zero vector gets returned in [RaycastHit.point](/engine/6000.0/script-reference/unityengine/raycasthit/point.md). You might want to check whether this is the case in your particular query and perform additional queries to refine the result.
