MIST terrainHeightDiff

From DCS World Wiki - Hoggitworld.com


mist.terrainHeightDiff

Added with: Mist 3.5
Description
Returns the height difference between the maximum and minimum heights within a given area around the point. If searchSize is not present the default search area will be 5 meters.
Syntax
number mist.terrainHeightDiff(table vec2/vec3 , number searchArea )
Valid Input Values:
vec2/vec3 = valid vec2/3 table

search area = positive number in meters

Return value:
number
Return example:
2.43
Usage Examples:
  do
    for i = 1, 10 do
      local newPoint = mist.getRandomPointInZone(point1, 1000)      
      if mist.isTerrainValid(newPoint, {'LAND'}) == true and mist.terrainHeightDiff(newPoint) < 3 then
        -- newPoint is flat enough to spawn the object
        break
      end
    end
  end
Notes:
Consider this function to be a 'terrain flatness check' to see if a given spot of land is flat enough to spawn an object appropriately.
Related Functions
makeUnitTable, getRandPointInCircle, getRandomPointInZone, isTerrainValid, terrainHeightDiff, getUnitsInZones, getUnitsInMovingZones, pointInPolygon, getUnitsInPolygon, getDeadMapObjsInZones, getDeadMapObjsInPolygonZone, getUnitsLOS, random, randomizeNumTable, stringMatch, getAvgPoint, getQFE

Scripting Engine

MIST Root Page