# Vector2.Clamp

## Overload 1

```csharp
Vector2 Clamp(Vector2 otherMin, Vector2 otherMax)
```

Returns a vector each axis of which is clamped to between the 2 given vectors. Basically clamps a point to a square.

### Parameters

- `otherMin` (`Vector2`): The mins vector. Values on each axis should be smaller than those of the maxs vector. See [Vector2.Sort](/api/Vector2/Sort).
- `otherMax` (`Vector2`): The maxs vector. Values on each axis should be larger than those of the mins vector. See [Vector2.Sort](/api/Vector2/Sort).

### Returns

`Vector2`

## Overload 2

```csharp
Vector2 Clamp(float min, float max)
```

Returns a vector each axis of which is clamped to given min and max values.

### Parameters

- `min` (`float`): Minimum value for each axis.
- `max` (`float`): Maximum value for each axis.

### Returns

`Vector2`

## Overload 3

```csharp
static Vector2 Clamp(in Vector2 value, in Vector2 min, in Vector2 max)
```

Restricts a vector between a minimum and maximum value.

### Parameters

- `in value` (`Vector2`): The vector to restrict.
- `in min` (`Vector2`): The mins vector. Values on each axis should be smaller than those of the maxs vector. See [Vector2.Sort](/api/Vector2/Sort).
- `in max` (`Vector2`): The maxs vector. Values on each axis should be larger than those of the mins vector. See [Vector2.Sort](/api/Vector2/Sort).

### Returns

`Vector2`

Declared in [Vector2](/api/Vector2).
Assembly: `Sandbox.System`.
