getDistanceBetweenPoints3D
Shared
Measures the straight-line distance between two points in space.
float getDistanceBetweenPoints3D(float x1, y1, z1, float x2, y2, z2)
Parameters
| Name | Type | Description |
|---|---|---|
| x1, y1, z1 | float | The first point. A vec3 also works. |
| x2, y2, z2 | float | The second point. A vec3 also works. |
Returns
The distance.
Example
local a = getElementPosition(playerA)
local b = getElementPosition(playerB)
print(("%.1f m apart"):format(getDistanceBetweenPoints3D(a, b)))