getDistanceBetweenPoints2D
Shared
Measures the distance between two points on the horizontal plane, ignoring height.
float getDistanceBetweenPoints2D(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)
if getDistanceBetweenPoints2D(a, b) < 50 then
print("close on the map")
end