# BoxCastNonAlloc(Vector3, Vector3, Vector3, RaycastHit[], Quaternion, float, int, QueryTriggerInteraction)

> Cast the box along the direction, and store hits in the provided buffer.

## Definition

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

```csharp
public static int BoxCastNonAlloc(Vector3 center, Vector3 halfExtents, Vector3 direction, RaycastHit[] results, 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.**** (\[RaycastHit\[]]\(/engine/6000.0/script-reference/unityengine/raycasthit)): The buffer to store the results in.**** (\[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                                      |
| ---------------------------------------------------------- | ------------------------------------------------ |
| [int](https://learn.microsoft.com/dotnet/api/system.int32) | The amount of hits stored to the results buffer. |
