Version: 5.4

Terrain.SampleHeight

Cambiar al Manual
public float SampleHeight (Vector3 worldPosition);

Descripción

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

void LateUpdate() {
    	Vector3 pos = transform.position;
        pos.y = Terrain.activeTerrain.SampleHeight(transform.position);
        transform.position = pos;
    }