Jump to content

Terrain related functions [example code]


Nero.ger

Recommended Posts

as mentioned in the other thread this is the list of usefull terrain related function for the "aircraft-enviroment". Pretty sure its not a complete list.

 


local map = get_terrain_related_data("name")
--on what map am i on?
--"Persian Gulf"
--"Caucasus"


local Terrain           = require('terrain')
--everything below requires Terrain
--X , Z , Alt Coords are in Meters!


Terrain.GetHeight(x, z)
--gives you the hight of the terrain at x,z  in meters
-- for a LOS check is suggest adding 1m to the hight, or round up
-- otherwise you might get strange results


Terrain.isVisible(x1, alt1, z1, x2, alt2, z2)
-- check Terrain Line of sight (ignores buildings/trees)

Terrain.GetSurfaceType(x,z)
-- gives you the type of terrain.
--  LAND             1
--  SHALLOW_WATER    2
--  WATER            3 
--  ROAD             4
--  RUNWAY           5
-- during my last test there was not landtype for Woods


local tmp_lat,tmp_long = Terrain.convertMetersToLatLon(x,z)
-- turns the Meters Coords system to LatLong (be aware , it returns 2 vars)

local x, z = Terrain.convertLatLonToMeters(lat,long)
--gets you the METERS coord system from Lat Long

 

 

other examples:

BasicRadar

Terrain Functions

BasicRWR


Edited by Nero.ger
Fixed error

'controlling' the Ka50 feels like a discussion with the Autopilot and trim system about the flight direction.

Link to comment
Share on other sites

as mentioned in the other thread this is the list of usefull terrain related function for the "aircraft-enviroment". Pretty sure its not a complete list.

 


local map = get_terrain_related_data("name")
--on what map am i on?
--"Persian Gulf"
--"Caucasus"


local Terrain           = require('terrain')
--everything below requires Terrain
--X , Z , Alt Coords are in Meters!


Terrain.GetHeight(x, z)
--gives you the hight of the terrain at x,z  in meters
-- for a LOS check is suggest adding 1m to the hight, or round up
-- otherwise you might get strange results


Terrain.isVisible(x1, alt1, z1, x2, alt2, z2)
-- check Terrain Line of sight (ignores buildings/trees)

Terrain.GetSurfaceType(x,z)
-- gives you the type of terrain.
--  LAND             1
--  SHALLOW_WATER    2
--  WATER            3 
--  ROAD             4
--  RUNWAY           5
-- during my last test there was not landtype for Woods


local tmp_lat,tmp_long = Terrain.convertMetersToLatLon(x,z)
-- turns the Meters Coords system to LatLong (be aware , it returns 2 vars)

local x, z = Terrain.convertLatLonToMeters(lat , long)
--gets you the METERS coord system from Lat Long

 

Thank you Nero.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...