What it does
Returns the distance between two scene entities, each found by its id or name.
Syntax
EntityDistance(entity string, other string) → floatParameters
| Name | Type | Meaning |
|---|---|---|
| entity | string | The first entity's id, name or tag. It must match exactly one entity. |
| other | string | The 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()LOOPEntityDistance 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.