Vector3 pos = transform.position;
pos.y = Terrain.activeTerrain.SampleHeight(transform.position);
transform.position = pos;
通过获取地形的SampleHeight来设置物体的实际Y值
Vector3 pos = transform.position;
pos.y = Terrain.activeTerrain.SampleHeight(transform.position);
transform.position = pos;
通过获取地形的SampleHeight来设置物体的实际Y值