STerrain
| 函数 | GetHeight | Get an interpolated height at a point x,y. |
| 函数 | GetSteepness | Get the gradient of the terrain at point (x,y). |
| 函数 | GetHeights | Returns a two dimensional array of heightmap samples. |
| 函数 | SetHeights | Sets heightmap data using a two dimensional array of heightmap samples. |
| 函数 | SetHeight | Set value to height of [x,y] |
| 函数 | GetNormal | Get an interpolated normal at a given location. |
| 函数 | GetSlope | Get a normalized and interpolated normal at a given location. |
| 函数 | GetContour | Get a contour of interpolated normal at a given location. |
| 属性 | Enabled | Is the Terrain component enabled? |
| 属性 | GameObject | The GameObject that this Terrain component is added to. |
函数
GetHeight
Get an interpolated height at a point x,y.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
返回值
float
示例
floatHeight = Space.Host.ExecutingObject.Terrain.GetHeight(1,1)
GetSteepness
Get the gradient of the terrain at point (x,y).
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
返回值
float
示例
floatSteepness = Space.Host.ExecutingObject.Terrain.GetSteepness(1,1)
GetHeights
Returns a two dimensional array of heightmap samples. The samples are represented as float values ranging from 0 to 1. The array has the dimensions [height,width] and is indexed as [y,x].
返回值
float[,]
示例
tableHeights = Space.Host.ExecutingObject.Terrain.GetHeights()
SetHeights
Sets heightmap data using a two dimensional array of heightmap samples. The samples are represented as float values ranging from 0 to 1. The heights array is indexed as [y,x].
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| data | float[,] | – |
返回值
void
示例
tableHeights = Space.Host.ExecutingObject.Terrain.SetHeights({{1,2},{1,2}})
SetHeight
Set value to height of [x,y]
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | int | – |
| y | int | – |
| value | float | – |
返回值
void
示例
Space.Host.ExecutingObject.Terrain.SetHeight(1,1,0.11)
GetNormal
Get an interpolated normal at a given location.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
返回值
SVector
示例
vectorNormal = Space.Host.ExecutingObject.Terrain.GetNormal(1,1)
GetSlope
Get a normalized and interpolated normal at a given location.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
返回值
SVector
示例
vectorSlope = Space.Host.ExecutingObject.Terrain.GetSlope(1,1)
GetContour
Get a contour of interpolated normal at a given location.
参数
| 名称 | 类型 | 默认值 |
|---|---|---|
| x | float | – |
| y | float | – |
返回值
SVector
示例
vectorContour = Space.Host.ExecutingObject.Terrain.GetContour(1,1)
属性
Enabled
Is the Terrain component enabled?
示例
Space.Host.ExecutingObject.Terrain.Enabled = false
GameObject只读
The GameObject that this Terrain component is added to.
示例
theGameObject = Space.Host.ExecutingObject.Terrain.GameObject



