dist();Calculates the distance between 2 points in 2D or 3D space.
dist(x1, y1, x2, y2);Arguments
x1The x coordinate of the first pointy1The y coordinate of the first pointx2The x coordinate of the second pointy2The y coordinate of the second pointlocal d = dist(0, 0, 3, 4);
print(d) -- 5dist(x1, y1, z1, x2, y2, z2);Arguments
x1The x coordinate of the first pointy1The y coordinate of the first pointz1The z coordinate of the first pointx2The x coordinate of the second pointy2The y coordinate of the second pointz2The z coordinate of the second pointlocal d = dist(0, 0, 0, 2, 3, 6);
print(d) -- 7dist(v1, v2);Arguments
v1The first vectorv2The second vectorlocal a = createVector(-1, -1);
local b = createVector( 2, 3);
local d = dist(a, b);
print(d) -- 5Returns
numberThe distance between the points