# Line.ClosestPoint

## Overload 1

```csharp
Vector3 ClosestPoint(in Vector3 pos)
```

Returns closest point on this line to the given point.

### Parameters

- `in pos` (`Vector3`)

### Returns

`Vector3`

## Overload 2

```csharp
bool ClosestPoint(in Ray ray, out Vector3 point_on_line)
```

Returns closest point on this line to the given ray.

### Parameters

- `in ray` (`Ray`)
- `out point_on_line` (`Vector3`)

### Returns

`bool`

## Overload 3

```csharp
bool ClosestPoint(in Ray ray, out Vector3 point_on_line, out Vector3 point_on_ray)
```

Returns closest point on this line to the given ray.

### Parameters

- `in ray` (`Ray`)
- `out point_on_line` (`Vector3`)
- `out point_on_ray` (`Vector3`)

### Returns

`bool`

Declared in [Line](/api/Line).
Assembly: `Sandbox.System`.
