| Returns a distance in meters between two [[Object]]s, [[Position]]s or [[Location]]s.

+

| Returns a distance in meters between [[Object]]s, [[Position]]s or [[Location]]s.

−

<br/><br/>'''NOTE:''' If positions are supplied as arguments, the coordinates are treated as [[PositionATL]] if over the land and as [[PositionASLW]] if over the sea. If 2D position is supplied, z is assumed 0.

+

<br><br>{{Important | If positions are supplied as arguments, the coordinates are treated as [[PositionATL]] if over the land and as [[PositionASLW]] if over the sea. If [[Position2D]] is supplied, z is assumed 0. If you need distance between two [[Position3D]] coordinates, use [[vectorDistance]]}}

<dt class="note">'''[[User:Rommel|Rommel]]'''<dd class="note">This returns the map distance, not the vector distance, [0,0,0] distance [0,0,1] can be >1 or <1, not exactly 1; unlike the vector math.

+

<dt class="note">[[User:Rommel|Rommel]]<dd class="note">This returns the map distance, not the vector distance, [0,0,0] distance [0,0,1] can be >1 or <1, not exactly 1; unlike the vector math.

<dd class="notedate">Posted on Aug 03, 2012 - 10:15

<dd class="notedate">Posted on Aug 03, 2012 - 10:15

−

<dt class="note">'''[[User:Ignoues01|Igneous01]]'''<dd class="note">If a position in format [x, y, z] is provided for both arguments, distance also checks the z dimension as well. Ie:

+

<dt class="note">[[User:Ignoues01|Igneous01]]<dd class="note">If a position in format [x, y, z] is provided for both arguments, distance also checks the z dimension as well. Ie:

player distance [0,0,200]

player distance [0,0,200]

will return 200, if the player is at this position at ground/sea level.

will return 200, if the player is at this position at ground/sea level.

<dd class="notedate">Posted on March 22, 2014

<dd class="notedate">Posted on March 22, 2014

−

<dt class="note">'''[[User:AgentRev01|AgentRev]]'''<dd class="note">When objects are supplied as arguments, distance is calculated from their model center (object modelToWorld [0,0,0]), and not the position returned by getPos/ATL/ASL.<br/>

+

<dt class="note">[[User:AgentRev01|AgentRev]]<dd class="note">When objects are supplied as arguments, distance is calculated from their model center (object modelToWorld [0,0,0]), and not the position returned by getPos/ATL/ASL.<br>

However, this is not relevant for units, as their model center matches their world position.

However, this is not relevant for units, as their model center matches their world position.

If a position in format [x, y, z] is provided for both arguments, distance also checks the z dimension as well. Ie:
player distance [0,0,200]
will return 200, if the player is at this position at ground/sea level.

When objects are supplied as arguments, distance is calculated from their model center (object modelToWorld [0,0,0]), and not the position returned by getPos/ATL/ASL.
However, this is not relevant for units, as their model center matches their world position.