---
name: "BIS_fnc_clampVector"
type: function
status: ok
groups: ["Vectors"]
arma3_since: "1.00"
locality: {"argument": null, "effect": null, "server_exec": false}
source: https://community.bistudio.com/wiki/BIS_fnc_clampVector
revid: 327749
updated: 2022-07-13T11:07:26Z
---

# BIS_fnc_clampVector

*Function · Vectors · Arma 3 v1.00*

## Description

Clamps vector values between provided min/max boundaries.

> [!NOTE]
> This function can be used to clamp any [Array](../topics/Array.md) of [Number](../topics/Number.md)s (even though it is not its main usage).

## Syntax

```sqf
[vector, min, max] call BIS_fnc_clampVector
```

**Parameters:**

- `vector`: [Vector3D](../topics/Vector3D.md) - (Optional, default [0,0,0]) the vector to be clamped
- `min`: [Number](../topics/Number.md) - (Optional, default 0)
- `max`: [Number](../topics/Number.md) - (Optional, default 0)

**Returns:** [Vector3D](../topics/Vector3D.md) - the clamped *vector*

## Examples

### Example 1

```sqf
private _newVelocity = [velocity vehicle player, -100, 100] call BIS_fnc_clampVector;
vehicle player setVelocity _newVelocity;
```

## See also

[BIS_fnc_clamp](../functions/BIS_fnc_clamp.md) · [vectorNormalized](../commands/vectorNormalized.md) · [vectorMultiply](../commands/vectorMultiply.md)

<sub>Source: [BI Community Wiki — BIS fnc clampVector](https://community.bistudio.com/wiki/BIS_fnc_clampVector) (revision 327749).</sub>
