Versions with this page:
Versions without this page:
在相对于地形空间的给定位置(以世界空间定义)进行高度采样。
using UnityEngine;public class ExampleScript : MonoBehaviour { void LateUpdate() { Vector3 pos = transform.position; pos.y = Terrain.activeTerrain.SampleHeight(transform.position); transform.position = pos; } }