> ## Documentation Index
> Fetch the complete documentation index at: https://lua.nlcrack.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# Vector

> 3D vector with arithmetic and math methods.

```lua theme={null} theme={null}
vector(x, y, z) -> vector
```

3D vector. Supports `+`, `-`, `*`, `/`, unary `-`, `==`.

## Methods

| Method | Returns | Description |
| - | - | - |
| `length()` | `number` | 3D length |
| `length_sqr()` | `number` | Squared 3D length |
| `length2d()` | `number` | 2D length (XY) |
| `dist(other)` | `number` | Distance to another vector |
| `dist2d(other)` | `number` | 2D distance |
| `dot(other)` | `number` | Dot product |
| `cross(other)` | `vector` | Cross product |
| `normalized()` | `vector` | Unit vector |
| `clone()` | `vector` | Copy |
| `unpack()` | `x, y, z` | Components |
| `is_zero()` | `bool` | All components zero |
| `lerp(other, t)` | `vector` | Linear interpolation |
| `forward()` | `vector` | Forward direction from angles |
| `angle_vectors()` | `forward, right, up` | All three basis vectors from angles |
| `angles()` | `vector` | Angles from direction vector |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.