# CapsulecastCommand

> Creates a CapsulecastCommand.

## Definition

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

## CapsulecastCommand(Vector3, Vector3, float, Vector3, QueryParameters, float)

Creates a CapsulecastCommand.

```csharp
public CapsulecastCommand(Vector3 p1, Vector3 p2, float radius, Vector3 direction, QueryParameters queryParameters, float distance = 3.4028235E+38)
```

### Parameters

**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): The center of the sphere at the `start` of the capsule.**** (\[Vector3]\(/engine/6000.7/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.7/script-reference/unityengine/vector3)): The direction of the capsule cast.**** (\[QueryParameters]\(/engine/6000.7/script-reference/unityengine/queryparameters)): Structure for specifying additional parameters for a batch query such as layer mask, hit triggers and hit backfaces.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The maximum length of the sweep.

### Remarks

This command is run in the default physics scene.

## CapsulecastCommand(PhysicsScene, Vector3, Vector3, float, Vector3, QueryParameters, float)

Creates a CapsulecastCommand.

```csharp
public CapsulecastCommand(PhysicsScene physicsScene, Vector3 p1, Vector3 p2, float radius, Vector3 direction, QueryParameters queryParameters, float distance = 3.4028235E+38)
```

### Parameters

**** (\[PhysicsScene]\(/engine/6000.7/script-reference/unityengine/physicsscene)): The physics scene to run the command in.**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): The center of the sphere at the `start` of the capsule.**** (\[Vector3]\(/engine/6000.7/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.7/script-reference/unityengine/vector3)): The direction of the capsule cast.**** (\[QueryParameters]\(/engine/6000.7/script-reference/unityengine/queryparameters)): Structure for specifying additional parameters for a batch query such as layer mask, hit triggers and hit backfaces.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The maximum length of the sweep.

## CapsulecastCommand(Vector3, Vector3, float, Vector3, float, int)

Creates a CapsulecastCommand.

> **Warning:**
>
> **Deprecated.** This struct signature is no longer supported. Use struct with a QueryParameters instead

```csharp
public CapsulecastCommand(Vector3 p1, Vector3 p2, float radius, Vector3 direction, float distance = 3.4028235E+38, int layerMask = -5)
```

### Parameters

**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): The center of the sphere at the `start` of the capsule.**** (\[Vector3]\(/engine/6000.7/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.7/script-reference/unityengine/vector3)): The direction of the capsule cast.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The maximum length of the sweep.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The [LayerMask](/engine/6000.7/script-reference/unityengine/layermask.md) that selectively ignores Colliders when casting a capsule.

### Remarks

This command is run in the default physics scene.

## CapsulecastCommand(PhysicsScene, Vector3, Vector3, float, Vector3, float, int)

Creates a CapsulecastCommand.

> **Warning:**
>
> **Deprecated.** This struct signature is no longer supported. Use struct with a QueryParameters instead

```csharp
public CapsulecastCommand(PhysicsScene physicsScene, Vector3 p1, Vector3 p2, float radius, Vector3 direction, float distance = 3.4028235E+38, int layerMask = -5)
```

### Parameters

**** (\[PhysicsScene]\(/engine/6000.7/script-reference/unityengine/physicsscene)): The physics scene to run the command in.**** (\[Vector3]\(/engine/6000.7/script-reference/unityengine/vector3)): The center of the sphere at the `start` of the capsule.**** (\[Vector3]\(/engine/6000.7/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.7/script-reference/unityengine/vector3)): The direction of the capsule cast.**** (\[float]\(https\://learn.microsoft.com/dotnet/api/system.single)): The maximum length of the sweep.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The [LayerMask](/engine/6000.7/script-reference/unityengine/layermask.md) that selectively ignores Colliders when casting a capsule.
