# CastRay(CastRayInput, out PhysicsShape)

> Check if a ray intersects the chain. See PhysicsQuery.CastResult.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

## CastRay(CastRayInput, PhysicsShape)

```csharp
public PhysicsQuery.CastResult CastRay(PhysicsQuery.CastRayInput castRayInput, out PhysicsShape chainSegmentShape)
```

### Parameters

**** (\[CastRayInput]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castrayinput)): The configuration of the ray to cast.**** (\[PhysicsShape]\(/engine/6000.7/script-reference/unity/u2d/physics/physicsshape)): A reference to the chain segment shape that the query found.

### Returns

| Type                                                                                       | Description                                        |
| ------------------------------------------------------------------------------------------ | -------------------------------------------------- |
| [CastResult](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castresult.md) | The intersection details, if any, that were found. |
