setTerrainHeight
Description
- Description:
Warning, this command is dangerous and if used incorrectly will cause issues.
Heightmap changes are stored in JIP queue, when doing multiple command invocations with the exact same XY positions (same number, same coordinates, order can be different) and different heights, the JIP messages will be merged which saves memory and network bandwidth and performance (each message is processed seperately) for joining clients.
If even just one position is missing or extra or different a new JIP message will be created, each new client will get the old and the new message, which costs bandwidth and performance because the client has to process both heightmap updates seperately.
JIP messages do NOT remove themselves if all positions are returned back to their original values, so if changes to different areas are done during a mission, they will accumulate in JIP queue.
setTerrainHeight should be used to set the height of an "area", and if that area should be further adjusted, the whole area should be adjusted and not just a subsection of it.
Edited terrain heights are not saved inside savegames, they need to be restored manually on savegame load.- Groups:
- Diagnostic
Syntax
- Syntax:
- setTerrainHeight
- Parameters:
- [ [X, Y, NewHeight], ... ]: Array of Array in format PositionASL XY are world coordinates, and are internally converted to heightmap coordinates like so
- adjustObjects: Bool optional, default true. If true then objects on modified points are moved up/down to keep the same ATL height (Danger! Even objects in the sky above modified terrain are adjusted)
- Return Value:
- Nothing
Examples
- Example 1:
- private _fnc_flattenTerrain = { params ["_start", "_a", "_b", "_h"]; _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; setTerrainHeight [[getPosWorld player, 50, 50, _desiredTerrainHeight] call _fnc_flattenTerrain, true];
Additional Information
- See also:
- getTerrainInfo getTerrainHeight
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note