MIST get3DDist

From DCS World Wiki - Hoggitworld.com
Revision as of 22:52, 13 April 2018 by Grimes (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


mist.utils.get3DDist

Added with: Mist 2.0
Description
Returns the distance between two point1 and point2 in 3D space.
Syntax
number mist.utils.get3DDist(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 slant range between the units "tank" and "myTank"
 local tankPos = Unit.getByName('tank'):getPosition().p
 local myPos = Unit.getByName('myTank'):getPosition().p
 local dist = mist.utils.get3DDist(tankPos, myPos)
 trigger.action.outText(tostring('Slant 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