DCS func getSurfaceType

From DCS World Wiki - Hoggitworld.com

Scripting Root

Envrioment: Mission Scripting
Function: getSurfaceType Added with: 1.2.0
Member Of: land
Syntax: enum land.getSurfaceType(table vec2 )
Description: Returns an enumerator for the surface type at a given point.

Enumerator is as follows:

land.SurfaceType 
  LAND             1
  SHALLOW_WATER    2
  WATER            3 
  ROAD             4
  RUNWAY           5


Return Value: enum
Return Example: 1
Examples: The following takes a number of trigger zones named "surf" with a suffix of 1 to 7 and returns the type of terrain enumerator ID and string to the dcs.log. Note that the function accepts a vec2 point so it is needed to be converted from vec2 to vec3. Can also be accomplished with a mist function mist.utils.makeVec2
for i = 1, 7 do
  local point = trigger.misc.getZone('surface'..i).point
  point.y = point.z
  local surfType = land.getSurfaceType(point)
  for str, ind in pairs(land.SurfaceType) do
   if ind == surfType then
    env.info('point ' .. i .. ' is type ' .. surfType .. ' String: ' .. str)			
   end
  end
end
Related Functions: land functions: getHeight, getSurfaceType, isVisible, getIP, profile, getClosestPointOnRoads, findPathOnRoads
Notes: