# Vec3.length

Returns the length of the vector.

**Kind:** Function

**Environments:** Game, Terrain

## Game

``` { .lua .api-signature }
vec3:length(  )
```

[Open the full Game reference](../Game-Script-Environment/Userdata/Vec3.md#length)

If you want the squared length, using [length2](../Game-Script-Environment/Userdata/Vec3.md#length2) is faster than squaring the result of this function.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `vector` | [Vec3](../Game-Script-Environment/Userdata/Vec3.md) | The vector. |

**Returns:**

| Type | Description |
| --- | --- |
| number | The length of the vector. |

## Terrain

``` { .lua .api-signature }
vec3:length(  )
```

[Open the full Terrain reference](../Terrain-Script-Environment/Userdata/Vec3.md#length)

If you want the squared length, using [length2](../Terrain-Script-Environment/Userdata/Vec3.md#length2) is faster than squaring the result of this function.

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `vector` | [Vec3](../Terrain-Script-Environment/Userdata/Vec3.md) | The vector. |

**Returns:**

| Type | Description |
| --- | --- |
| number | The length of the vector. |
