TerrainData

class in UnityEngine

/

Hereda de:Object

Cambiar al Manual

Descripción

The TerrainData class stores heightmaps, detail mesh positions, tree instances, and terrain texture alpha maps.

The Terrain component links to the terrain data and renders it.

Variables Estáticas

AlphamapTextureNameThe name for the Terrain alpha map textures.
HolesTextureNameThe name for the Terrain holes Texture.

Variables

alphamapHeightHeight of the alpha map.
alphamapLayersNumber of alpha map layers.
alphamapResolutionResolution of the alpha map.
alphamapTextureCountReturns the number of alphamap textures.
alphamapTexturesAlpha map textures used by the Terrain. Used by Terrain Inspector for undo.
alphamapWidthWidth of the alpha map.
baseMapResolutionResolution of the base map used for rendering far patches on the terrain.
boundsThe local bounding box of the TerrainData object.
detailHeightDetail height of the TerrainData.
detailPatchCountThe number of patches along a terrain tile edge. This is squared to make a grid of patches.
detailPrototypesContains the detail texture/meshes that the terrain has.
detailResolutionDetail Resolution of the TerrainData.
detailResolutionPerPatchDetail Resolution of each patch. A larger value will decrease the number of batches used by detail objects.
detailWidthDetail width of the TerrainData.
enableHolesTextureCompressionEnable the Terrain holes Texture compression.
heightmapResolutionResolution of the heightmap.
heightmapScaleThe size of each heightmap sample.
heightmapTextureReturns the heightmap texture.
holesResolutionReturns the Terrain holes resolution for both the data and the Texture.
holesTextureReturns the Terrain holes Texture.
sizeThe total size in world units of the terrain.
terrainLayersRetrieves the terrain layers used by the current terrain.
treeInstanceCountReturns the number of tree instances.
treeInstancesContains the current trees placed in the terrain.
treePrototypesThe list of tree prototypes this are the ones available in the inspector.
wavingGrassAmountAmount of waving grass in the terrain.
wavingGrassSpeedSpeed of the waving grass.
wavingGrassStrengthStrength of the waving grass in the terrain.
wavingGrassTintColor of the waving grass that the terrain has.

Funciones Públicas

CopyActiveRenderTextureToHeightmapCopies the specified part of the active RenderTexture to the Terrain heightmap texture.
CopyActiveRenderTextureToTextureCopies the specified part of the active RenderTexture to the Terrain texture.
DirtyHeightmapRegionMarks the specified part of the heightmap as dirty.
DirtyTextureRegionMarks the specified part of the Terrain texture as dirty.
GetAlphamapsReturns the alpha map at a position x, y given a width and height.
GetAlphamapTextureReturns the alphamap texture at the specified index.
GetDetailLayerReturns a 2D array of the detail object density in the specific location.
GetHeightObtiene la altitud en el punto x, y indicado.
GetHeightsGet an array of heightmap samples.
GetHolesGets an array of Terrain holes samples.
GetInterpolatedHeightGets an interpolated height at a point x,y. The x and y coordinates are clamped to [0, 1].
GetInterpolatedHeightsGets an array of terrain height values using the normalized x,y coordinates.
GetInterpolatedNormalGet an interpolated normal at a given location.
GetMaximumHeightErrorReturns an array of tesselation maximum height error values per renderable terrain patch. The returned array can be modified and passed to OverrideMaximumHeightError.
GetPatchMinMaxHeightsReturns an array of min max height values for all the renderable patches in a terrain. The returned array can be modified and then passed to OverrideMinMaxPatchHeights.
GetSteepnessObtiene la altitud en el punto x, y indicado.
GetSupportedLayersReturns an array of all supported detail layer indices in the area.
GetTreeInstanceGets the tree instance at the specified index. It is used as a faster version of treeInstances[index] as this function doesn't create the entire tree instances array.
IsHoleGets whether a certain point at x,y is a hole.
OverrideMaximumHeightErrorOverride the maximum tessellation height error with user provided values. Note that the overriden values get reset when the terrain resolution is changed and stays unchanged when the terrain heightmap is painted or changed via script.
OverrideMinMaxPatchHeightsOverride the minimum and maximum patch heights for every renderable terrain patch. Note that the overriden values get reset when the terrain resolution is changed and stays unchanged when the terrain heightmap is painted or changed via script.
RefreshPrototypesReloads all the values of the available prototypes (ie, detail mesh assets) in the TerrainData Object.
SetAlphamapsAssign all splat values in the given map area.
SetBaseMapDirtyMarks the terrain data as dirty to trigger an update of the terrain basemap texture.
SetDetailLayerSets the detail layer density map.
SetDetailResolutionSets the resolution of the detail map.
SetHeightsSets an array of heightmap samples.
SetHeightsDelayLODSets an array of heightmap samples.
SetHolesSets an array of Terrain holes samples.
SetHolesDelayLODSets an array of Terrain holes samples.
SetTerrainLayersRegisterUndoThis function sets the terrainLayers property, and in addition, registers the action to the Editor's undo stack.
SetTreeInstanceSets the tree instance with new parameters at the specified index. However, you cannot change TreeInstance.prototypeIndex and TreeInstance.position. If you change them, the method throws an ArgumentException.
SetTreeInstancesSets the Tree Instance array, and optionally snaps Trees onto the surface of the Terrain heightmap.
SyncHeightmapPerforms synchronization queued by previous calls to CopyActiveRenderTextureToHeightmap and DirtyHeightmapRegion, which makes the height data and LOD data used for tessellation up to date.
SyncTexturePerforms synchronization queued by previous calls to CopyActiveRenderTextureToTexture and DirtyTextureRegion, which makes CPU data of the Terrain textures up to date.

Miembros heredados

Variables

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameEl nombre del objeto.

Funciones Públicas

GetInstanceIDDevuelve el id de la instancia del objeto.
ToStringReturns the name of the object.

Funciones Estáticas

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindObjectOfTypeDevuelve el primer objeto activo cargado de tipo type.
FindObjectsOfTypeDevuelve una lista de todos los objetos activos cargados de tipo type.
InstantiateClona el objeto original y devuelve el clon.

Operadores

bool¿Existe el objeto?
operator !=Compare si dos objetos se refieren a un objeto diferente.
operator ==Compara dos referencias de objeto para ver si se refieren al mismo objeto.