Dynamic Terrain Objects

Runtime modification of Unity Terrain is a tricky problem to solve. Managing the translation of world space into terrain heightmap and alphamap space, modifying those values, and then writing them back to the correct part of the terrain is handled seamlessly by Dynamic Terrain Objects. Here is a quick overview of a few of the features found in the library:


Check out the Quick-Start Guide to get going.

Library Overview: Deformer class

This is a quick overview of the Deformer class which is the main point of interaction with the library. Drop the Deformer script on your GameObject and it is now a dynamic terrain object. All “Now” functions are to conveniently set terrain changes and commit them to the terrain in one step. For compound deformations (for example: Add and Smooth in one frame) use the non-“Now” versions of each function and then call “SetHeights” and/or “SetAlphas” once finished. Please see the Deformer’s detailed class documentation for more in depth information.

Attributes

  • terrainAreaPadding
  • terrainTextureIndex
  • terrainTextureOpacity
  • alphaPadding
  • alphaFitType
  • heightFitType
  • flattenTo
  • flattenArea
  • keepTerrainAreaUpdated
  • restoreTerrainOnExit
  • useDelayedLOD

Public Functions

  • AddNow()
  • Add()
  • SubtractNow()
  • Subtract()
  • SmoothNow()
  • Smooth()
  • TextureNow()
  • Texture()
  • Embrace()
  • Flatten()
  • ShowAreaVertices()
  • ShowAreaAlphas()
  • DestroyDebugObjects()
  • UpdateAreaPosition()
  • SetHeights()
  • SetAlphas()