{"name":"getTerrainInfo","operator":null,"title":"getTerrainInfo","type":"command","url":"https://community.bistudio.com/wiki/getTerrainInfo","revid":377882,"updated":"2026-01-04T16:22:56Z","groups":["Positions"],"status":"ok","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"2.10"}],"since":{"game":"arma3","name":"Arma 3","version":"2.10"},"arma3_since":"2.10","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"description":"Returns the terrain heightmap information, as well as sea level offset (due to tides, if available).","syntaxes":[{"syntax":"getTerrainInfo","since":null,"effect":null,"exec":null,"params":[],"returns":{"type":"Array with [landGridWidth, landGridSize, terrainGridWidth, terrainGridSize, seaLevel]","types":["Array"],"description":"landGridWidth: Number - width of each land grid, in meters - landGridSize: Number - number of land grid pixels - terrainGridWidth: Number width of each terrain grid, in meters (also known as \"cell size\") - terrainGridSize: Number - number of terrain grid pixels (also known as \"heightmap resolution\") - seaLevel: Number - sea level without waves. The value is `0` if tides are disabled. > [!NOTE] > - The result of `landGridWidth * landGridSize` and `terrainGridWidth * terrainGridSize` is always equal to the worldSize. > - \"land grid\" is used by the game for object placement (e.g. finding the nearestObject), dynamic simulation, etc. > - \"terrain grid\" is the actual terrain, used to display the terrain, calculate terrain height, surface normal, etc.","text":"Array with [landGridWidth, landGridSize, terrainGridWidth, terrainGridSize, seaLevel]\n- landGridWidth: Number - width of each land grid, in meters\n- landGridSize: Number - number of land grid pixels\n- terrainGridWidth: Number width of each terrain grid, in meters (also known as \"cell size\")\n- terrainGridSize: Number - number of terrain grid pixels (also known as \"heightmap resolution\")\n- seaLevel: Number - sea level without waves. The value is `0` if tides are disabled.\n\n> [!NOTE]\n> - The result of `landGridWidth * landGridSize` and `terrainGridWidth * terrainGridSize` is always equal to the worldSize.\n> - \"land grid\" is used by the game for object placement (e.g. finding the nearestObject), dynamic simulation, etc.\n> - \"terrain grid\" is the actual terrain, used to display the terrain, calculate terrain height, surface normal, etc."},"form":"nullary","operator":null,"left":null,"right":null}],"examples":[{"text":"```sqf\nprivate _terrainInfo = getTerrainInfo; // Stratis: [32,256,4,2048,0]; Altis: [30,1024,7.5,4096,0]\n```","code":["private _terrainInfo = getTerrainInfo; // Stratis: [32,256,4,2048,0]; Altis: [30,1024,7.5,4096,0] "]},{"text":"```sqf\n// Draws a 20x20 terrain grid when clicking on the map\n// Each triangle of the terrain is formed by a diagonal\n// that starts from the top-left corner of the cell and ends at the bottom-right corner.\n// The green lines show the cell diagonals \nonMapSingleClick {\n    getTerrainInfo params [\"\", \"\", \"_cellsize\", \"_resolution\"];\n    gridLines = [];\n    _pos apply { floor (_x / _cellsize) } params [\"_x0\", \"_y0\"];\n    for \"_x\" from ((_x0 - 10) max 0) to ((_x0 + 10) min _resolution) do\n    {\n        for \"_y\" from ((_y0 - 10) max 0) to ((_y0 + 10) min _resolution) do\n        {\n            private _p1 = [_x, _y] vectorMultiply _cellsize;        // bottom-left corner\n            private _p2 = [_x, _y + 1] vectorMultiply _cellsize;    // top-left corner\n            private _p3 = [_x + 1, _y] vectorMultiply _cellsize;    // bottom-right corner\n            // Positions are AGL, and Z value of 0 is already at the terrain surface (except on water surface). \n            // Just move them up a few centimeters so they're visible.\n            _p1 set [2, 0.1];\n            _p2 set [2, 0.1];\n            _p3 set [2, 0.1];\n\n            gridLines pushBack [_p1, _p2, [1,0,0,1]];\n            gridLines pushBack [_p1, _p3, [1,0,0,1]];\n            gridLines pushBack [_p2, _p3, [0,1,0,1]];\n        };\n    };\n\n    onEachFrame {\n        {\n            drawLine3D _x;\n        } forEach gridLines;\n    }\n};\n```","code":["// Draws a 20x20 terrain grid when clicking on the map\n// Each triangle of the terrain is formed by a diagonal\n// that starts from the top-left corner of the cell and ends at the bottom-right corner.\n// The green lines show the cell diagonals \nonMapSingleClick {\n\tgetTerrainInfo params [\"\", \"\", \"_cellsize\", \"_resolution\"];\n\tgridLines = [];\n\t_pos apply { floor (_x / _cellsize) } params [\"_x0\", \"_y0\"];\n\tfor \"_x\" from ((_x0 - 10) max 0) to ((_x0 + 10) min _resolution) do\n\t{\n\t\tfor \"_y\" from ((_y0 - 10) max 0) to ((_y0 + 10) min _resolution) do\n\t\t{\n\t\t\tprivate _p1 = [_x, _y] vectorMultiply _cellsize;\t\t// bottom-left corner\n\t\t\tprivate _p2 = [_x, _y + 1] vectorMultiply _cellsize;\t// top-left corner\n\t\t\tprivate _p3 = [_x + 1, _y] vectorMultiply _cellsize;\t// bottom-right corner\n\t\t\t// Positions are AGL, and Z value of 0 is already at the terrain surface (except on water surface). \n\t\t\t// Just move them up a few centimeters so they're visible.\n\t\t\t_p1 set [2, 0.1];\n\t\t\t_p2 set [2, 0.1];\n\t\t\t_p3 set [2, 0.1];\n\n\t\t\tgridLines pushBack [_p1, _p2, [1,0,0,1]];\n\t\t\tgridLines pushBack [_p1, _p3, [1,0,0,1]];\n\t\t\tgridLines pushBack [_p2, _p3, [0,1,0,1]];\n\t\t};\n\t};\n\n\tonEachFrame {\n\t\t{\n\t\t\tdrawLine3D _x;\n\t\t} forEach gridLines;\n\t}\n};"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["getTerrainHeight","setTerrainHeight","worldSize"],"notes":[],"categories":["Arma 3: New Scripting Commands","Arma 3: Scripting Commands","Command Group: Positions","Introduced with Arma 3 version 2.10","Scripting Commands"]}