Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

SampleHeight(worldPosition: Vector3): float;

Description

Samples the height at the given position defined in world space, relative to the terrain space.

	function LateUpdate () {
		transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);
	}