Terrain.SampleHeight 取样高度

function SampleHeight (worldPosition : Vector3) : float

Description描述

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

在给定位置定义的取样高度,相对于地形坐标空间。

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	void LateUpdate() {

		transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);

	}

}
function LateUpdate () {

	transform.position.y = Terrain.activeTerrain.SampleHeight(transform.position);

}
Page last updated: 2011-4-1