Class OptimizeHeightRange
Exposes functions for making the best available use of the heightmap range on a given terrain
Inherited Members
Namespace: UnityEditor .TerrainTools
Assembly: Unity.TerrainTools.Editor.dll
Syntax
public static class OptimizeHeightRange
Methods
GetTerrainHeightRange(out float, out float, params TerrainData[])
Returns the minimum and maximum world height values for
Declaration
public static void GetTerrainHeightRange(out float minHeight, out float maxHeight, params TerrainData[] terrainDatas)
Parameters
Type | Name | Description |
---|---|---|
float | minHeight | float (will be reset) |
float | maxHeight | float (will be reset) |
Terrain |
terrainDatas | One or more Terrain object |
OptimizeSelectedTerrains(float, float)
Performs RemapTerrainHeights on the currently selected Terrain with a target efficiency of 95%
Declaration
public static void OptimizeSelectedTerrains(float padBottom = 0.025, float padTop = 0.025)
Parameters
Type | Name | Description |
---|---|---|
float | padBottom | Padding added below the height range; 0 - 1, relative the total height. |
float | padTop | Padding added above the height range; 0 - 1, relative the total height. |
RemapSelectedTerrains(int, int)
Remap selected terrain objects to use the specified height range.
Unlike OptimizeSelectedTerrains this can be applied to multiple objects
Declaration
public static void RemapSelectedTerrains(int minY, int maxY)
Parameters
Type | Name | Description |
---|---|---|
int | minY | The lower world-space bound of the intended height range |
int | maxY | The upper world-space bound of the intended height range |
RemapTerrainHeights(Terrain, int, int)
Remap the heightmap pixels in a given Terrain so they completely fill a user-supplied range of heightmap values while preserving their current world positions. Heights outside the supplied range will be truncated to fit.
Declaration
public static void RemapTerrainHeights(Terrain targetTerrain, int heightMapMin, int heightMapMax)