M MY Multiplayer: Wiki
Side
Kind

getDistanceBetweenPoints3D

Shared

Measures the straight-line distance between two points in space.

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

Parameters

NameTypeDescription
x1, y1, z1floatThe first point. A vec3 also works.
x2, y2, z2floatThe 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)))

See also