MIST get2DDist

From DCS World Wiki - Hoggitworld.com


mist.utils.get2DDist

Added with: Mist 2.0
Description
Returns the distance between two point1 and point2 in 2D space.
Syntax
number mist.utils.get2DDist(table point1 ,table point2 )
Valid Input Values:
point1 = vec2 or vec3

point2 = vec2 or vec3

Return value:
number
Return example:
4000
Usage Examples:
Returns the distance between the units "tank" and "myTank"
 local tankPos = Unit.getByName('tank'):getPosition().p
 local myPos = Unit.getByName('myTank'):getPosition().p
 local dist = mist.utils.get2DDist(tankPos, myPos)
 trigger.action.outText(tostring('Range to target is: ' .. dist), 30)
Notes:
Related Functions
add, sub, scalar_mult, dp, cp, mag, getUnitVec, rotateVec2, get2DDist, get3DDist, getHeadingPoints

Scripting Engine

MIST Root Page