# getDistanceBetweenPoints3D (Compartilhado)

> Mede a distância em linha reta entre dois pontos no espaço.

- **Plataforma**: MY Multiplayer (MYMP)
- **Tipo**: Função Lua
- **Lado**: Compartilhado
- **Categoria**: Dados e utilidades
- **URL**: https://wiki.mymp.gg/pt/getDistanceBetweenPoints3D

## Sintaxe

```lua
float getDistanceBetweenPoints3D(float x1, y1, z1, float x2, y2, z2)
```

## Parâmetros

| Nome | Tipo | Descrição |
| --- | --- | --- |
| `x1, y1, z1` | `float` | O primeiro ponto. Também aceita um `vec3`. |
| `x2, y2, z2` | `float` | O segundo ponto. Também aceita um `vec3`. |

## Retorno

A distância.

## Exemplo

```lua
local a = getElementPosition(playerA)
local b = getElementPosition(playerB)
print(("%.1f m apart"):format(getDistanceBetweenPoints3D(a, b)))
```

## Veja também

- [getDistanceBetweenPoints2D (Compartilhado)](https://wiki.mymp.gg/pt/getDistanceBetweenPoints2D.md): Mede a distância entre dois pontos no plano horizontal, ignorando a altura.
