# CastRay(CastRayInput, bool)

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

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.LowLevelPhysics2D](/engine/6000.3/script-reference/unityengine/lowlevelphysics2d.md)
* **Assembly:** UnityEngine.Physics2DModule

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

### Parameters

**** (\[CastRayInput]\(/engine/6000.3/script-reference/unityengine/lowlevelphysics2d/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.3/script-reference/unityengine/lowlevelphysics2d/physicsquery/castresult.md) | The results of the intersection test. |
