Scripting API

TerrainData

class in UnityEngine · UnityEngine.TerrainModule · inherits from Object

13 of 74 of Unity's membersUnity's documentation
In Tassix

A terrain's heightmap and size, as Unity keeps them: heights are 16-bit (0 to 1 in steps of 1/32766), indexed [y, x].

Constructors 1

Properties 7

Bounds bounds { get; }

The box the heights fill, in the terrain's space.

int heightmapHeight { get; }
int heightmapResolution { get; set; }

Samples per side: a power of two plus one, 33 to 4097. Changing it clears the heights.

Vector3 heightmapScale { get; }

The size of a heightmap cell, and the height of 1.

int heightmapWidth { get; }
Vector3 size { get; set; }
float thickness { get; set; }

Methods 8

float GetHeight(int x, int y)

A sample's height in world units.

float[, ] GetHeights(int xBase, int yBase, int width, int height)

Heights from 0 to 1, [y, x], from a corner.

float GetInterpolatedHeight(float x, float y)

The height at a point given from 0 to 1 across the terrain, between samples.

Vector3 GetInterpolatedNormal(float x, float y)

The surface's normal at a point given from 0 to 1 across the terrain.

float GetSteepness(float x, float y)

The slope in degrees at a point given from 0 to 1 across the terrain.

void SetHeights(int xBase, int yBase, float[, ] heights)

Sets heights from 0 to 1, [y, x], from a corner.

void SetHeightsDelayLOD(int xBase, int yBase, float[, ] heights)
void SyncHeightmap()

Not in Tassix yet 61

AlphamapTextureName ComputeDetailCoverage ComputeDetailInstanceTransforms CopyActiveRenderTextureToHeightmap CopyActiveRenderTextureToTexture DirtyHeightmapRegion DirtyTextureRegion GetAlphamapTexture GetAlphamaps GetClampedDetailPatches GetDetailLayer GetHoles GetInterpolatedHeights GetMaximumHeightError GetPatchMinMaxHeights GetSupportedLayers GetTreeInstance HolesTextureName IsHole OverrideMaximumHeightError OverrideMinMaxPatchHeights RefreshPrototypes RemoveDetailPrototype SetAlphamaps SetBaseMapDirty SetDetailLayer SetDetailResolution SetDetailScatterMode SetHoles SetHolesDelayLOD SetTerrainLayersRegisterUndo SetTreeInstance SetTreeInstances SyncTexture alphamapHeight alphamapLayers alphamapResolution alphamapTextureCount alphamapTextures alphamapWidth baseMapResolution detailHeight detailPatchCount detailPrototypes detailResolution detailResolutionPerPatch detailScatterMode detailWidth enableHolesTextureCompression heightmapTexture holesResolution holesTexture maxDetailScatterPerRes terrainLayers treeInstanceCount treeInstances treePrototypes wavingGrassAmount wavingGrassSpeed wavingGrassStrength wavingGrassTint

Checked against Unity

Conformance scenarios that exercise it, recorded in Unity and compared event by event.