# CastRay(CastRayInput, bool)

> Calculate if a world ray intersects the geometry. See PhysicsQuery.CastResult.

## Definition

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

```csharp
public readonly PhysicsQuery.CastResult CastRay(PhysicsQuery.CastRayInput castRayInput, bool oneSided = false)
```

### Parameters

**** (\[CastRayInput]\(/engine/6000.5/script-reference/unity/u2d/physics/physicsquery/castrayinput)): The configuration of the ray to cast.**** (\[bool]\(https\://learn.microsoft.com/dotnet/api/system.boolean)): Whether to treat the segment as having one-sided collision. The "left" side collision is ignored.

### Returns

| Type                                                                                       | Description                           |
| ------------------------------------------------------------------------------------------ | ------------------------------------- |
| [CastResult](/engine/6000.5/script-reference/unity/u2d/physics/physicsquery/castresult.md) | The results of the intersection test. |
