---
name: "setTerrainHeight"
type: command
status: ok
groups: ["Positions"]
arma3_since: "2.10"
locality: {"argument": null, "effect": "global", "server_exec": true}
source: https://community.bistudio.com/wiki/setTerrainHeight
revid: 377594
updated: 2026-01-02T06:59:43Z
---

# setTerrainHeight

*Command · Positions · Arma 3 v2.10*

Locality: effect **global** · **server execution only**

## Description

Set the current terrain's altitude on provided location(s).

> [!IMPORTANT]
> - Heightmap changes:
>   - are internally converted (rounded) to heightmap coordinates
>   - are stored in the JIP queue
>   - are **not** removed from the JIP queue if the values are set back to terrain's default value
>   - are updated in the JIP queue for updated positions **if** the same group of positions are edited (order does not matter, but amount does);
> editing positions by terrain *sections* is good for multiplayer optimisation (see [#Example 2](../commands/setTerrainHeight.md#example-2))
>   - are **not** updated and sent twice (old one then new one) if position edits are not exactly the same (see point above and [#Example 2](../commands/setTerrainHeight.md#example-2)).
> - Edited terrain heights are **not** saved inside savegames, they need to be restored manually on savegame load.
> - Known issues:
>   - Terrain sections can become invisible if the change is too extreme
>   - Walking on the edge of extreme height changes can catapult the player away

## Syntax

```sqf
setTerrainHeight [positionAndAltitudeArray, adjustObjects]
```

**Parameters:**

- `positionAndAltitudeArray`: [Array](../topics/Array.md) of [PositionASL](../topics/Position.md#positionasl) - [[x1, y1, newASLHeight1], [x2, y2, newASLHeight2], ...]
- `adjustObjects`: [Boolean](../topics/Boolean.md) - (Optional, default [true](../commands/true.md)) if true then objects on modified points are moved up/down to keep the same ATL height

  > [!IMPORTANT]
  > **All** objects above modified terrain will be adjusted, even flying ones.

**Returns:** [Nothing](../topics/Nothing.md)

## Examples

### Example 1

```sqf
private _fnc_flattenTerrain =
{
    params ["_start", "_a", "_b", "_h"];
    private _newPositions = [];

    for "_xStep" from 0 to _a do
    {
        for "_yStep" from 0 to _b do
        {
            private _newHeight = _start vectorAdd [_xStep, _yStep, 0];
            _newHeight set [2, _h];
            _newPositions pushBack _newHeight;
        };
    };

    _newPositions;
};

private _desiredTerrainHeight = 150;
private _positionsAndHeights = [getPosWorld player, 50, 50, _desiredTerrainHeight] call _fnc_flattenTerrain;
setTerrainHeight [_positionsAndHeights, true];
```

### Example 2

Bad example:

```sqf
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];

// second update - this will make the JIP queue keep both messages
setTerrainHeight [[[1005, 1000, 50]]];
```

Good example:

```sqf
// first update
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]];

// second update - this will update the JIP queue properly
setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]];
```

## See also

[getTerrainInfo](../commands/getTerrainInfo.md) · [getTerrainHeight](../commands/getTerrainHeight.md)

<sub>Source: [BI Community Wiki — setTerrainHeight](https://community.bistudio.com/wiki/setTerrainHeight) (revision 377594).</sub>
