setTerrainHeight: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Add back terrain section phrasing) |
Lou Montana (talk | contribs) m (Fix typo) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
|version1= 2.10 | |version1= 2.10 | ||
|eff= global | |eff= global | ||
Line 12: | Line 11: | ||
|gr1= Diagnostic | |gr1= Diagnostic | ||
|descr= | |descr= Set the current terrain's altitude on provided location(s). | ||
Set the current terrain's altitude on provided location(s). | |||
{{Feature|important| | {{Feature|important| | ||
* Heightmap changes: | * Heightmap changes: | ||
Line 22: | Line 20: | ||
** are '''not''' updated and sent twice (old one then new one) if position edits are not exactly the same (see point above and {{Link|#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 {{Link|#Example 2}}). | ||
* Edited terrain heights are '''not''' saved inside savegames, they need to be restored manually on savegame load. | * 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 | |||
}} | }} | ||
Line 53: | Line 54: | ||
private _desiredTerrainHeight = 150; | private _desiredTerrainHeight = 150; | ||
private _positionsAndHeights = [getPosWorld player, 50, 50, _desiredTerrainHeight] call _fnc_flattenTerrain; | |||
setTerrainHeight [_positionsAndHeights, true]; | |||
</sqf> | </sqf> | ||
Line 59: | Line 61: | ||
<sqf> | <sqf> | ||
// first update | // first update | ||
setTerrainHeight [[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]; | setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]]; | ||
// second update - this will make the JIP queue keep both messages | // second update - this will make the JIP queue keep both messages | ||
setTerrainHeight [[1005, 1000, 50]]; | setTerrainHeight [[[1005, 1000, 50]]]; | ||
</sqf> | </sqf> | ||
Line 68: | Line 70: | ||
<sqf> | <sqf> | ||
// first update | // first update | ||
setTerrainHeight [[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]; | setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 25], [1000, 1005, 25], [1005, 1005, 25]]]; | ||
// second update - this will update the JIP queue properly | // second update - this will update the JIP queue properly | ||
setTerrainHeight [[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]; | setTerrainHeight [[[1000, 1000, 25], [1005, 1000, 50], [1000, 1005, 25], [1005, 1005, 25]]]; | ||
</sqf> | </sqf> | ||
|seealso= [[getTerrainInfo]] [[getTerrainHeight]] | |seealso= [[getTerrainInfo]] [[getTerrainHeight]] | ||
}} | }} |
Latest revision as of 14:22, 10 April 2023
Description
- Description:
- Set the current terrain's altitude on provided location(s).
- Groups:
- Diagnostic
Syntax
- Syntax:
- setTerrainHeight [positionAndAltitudeArray, adjustObjects]
- Parameters:
- positionAndAltitudeArray: Array of Array in format PositionASL - [[x1, y1, newASLHeight1], [x2, y2, newASLHeight2], ...]
- adjustObjects: Boolean - (Optional, default true) if true then objects on modified points are moved up/down to keep the same ATL height
- Return Value:
- Nothing
Examples
- Example 1:
- 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:
Good example:// 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]]];// 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]]];
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