ドキュメント

Unity Engine

Unity Engine

CopyActiveRenderTextureToHeightmap(RectInt, Vector2Int, TerrainHeightmapSyncControl)

Copies the specified part of the active RenderTexture to the Terrain heightmap texture.
読み終わるまでの所要時間 1 分最終更新 1ヶ月前

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.TerrainModule
public void CopyActiveRenderTextureToHeightmap(RectInt sourceRect, Vector2Int dest, TerrainHeightmapSyncControl syncControl)

Parameters

sourceRect

The part of the active Render Texture to copy.

The X and Y coordinates of the heightmap texture to copy into.

Controls how CPU synchronization is performed.

Remarks

This functions calls TerrainData.DirtyHeightmapRegion internally and sends out the OnTerrainChanged message accordingly.
The range of expected height values for the active RenderTexture is between
0
and
0.5
. This is unlike TerrainData.SetHeights, which expects height values between
0
and
1
. Additional Resources: TerrainHeightmapSyncControl, TerrainData.DirtyHeightmapRegion, TerrainData.SyncHeightmap.