EntityDistance

Family: Studio · One form

What it does

Returns the distance between two scene entities, each found by its id or name.

Syntax

EntityDistance(entity string, other string) → float

Parameters

NameTypeMeaning
entitystringThe first entity's id, name or tag. It must match exactly one entity.
otherstringThe second entity's id, name or tag. It must match exactly one entity.

Every form returns

float

The straight-line 3D distance between their positions, or -1 when either name does not match exactly one entity.

Example · generated

DO  Print(EntityDistance("value", "value"))  Sync()LOOP

EntityDistance is called and its answer is printed every frame. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

133 commands in Studio