# Sandbox.UI.Panel.RayToLocalPosition

```csharp
bool RayToLocalPosition(Ray ray, out Vector2 position, out float distance)
```

Transform a ray in 3D space to a position on the panel. This is used for world panel input.

### Parameters

- `ray` (`Ray`): The ray in 3D world space to test against this panel.
- `out position` (`Vector2`): Position on the panel where the intersection happened, local to the panel's top left corner.
- `out distance` (`float`): Distance from the ray's origin to the intersection in 3D space.

### Returns

`bool`: Return true if a hit/intersection was detected.

Declared in [Sandbox.UI.Panel](/api/Sandbox.UI.Panel).
Assembly: `Sandbox.Engine`.
