# CapsuleCastNonAlloc(Vector3, Vector3, float, Vector3, RaycastHit[], float, int, QueryTriggerInteraction)

> Casts a capsule against all colliders in the Scene and returns detailed information on what was hit into the buffer.

## Definition

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

```csharp
public static int CapsuleCastNonAlloc(Vector3 point1, Vector3 point2, float radius, Vector3 direction, RaycastHit[] results, float maxDistance, int layerMask, QueryTriggerInteraction queryTriggerInteraction)
```

### Parameters

**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): The center of the sphere at the start of the capsule.**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): The center of the sphere at the end of the capsule.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The radius of the capsule.**** (\[Vector3]\(/engine/6000.0/script-reference/unityengine/vector3)): The direction into which to sweep the capsule.**** (\[RaycastHit\[]]\(/engine/6000.0/script-reference/unityengine/raycasthit)): The buffer to store the hits into.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The max length of the sweep.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): A [Layer mask](/engine/6000.0/manual/working-with-gameobjects/layers.md) that is used to selectively ignore colliders when casting a capsule.**** (\[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 into the buffer. |

### Remarks

Like [Physics.CapsuleCastAll](/engine/6000.0/script-reference/unityengine/physics/capsulecastall.md), but generates no garbage.
