Breakroom is now Sinewave Campus. Book a meeting

STerrain

客户端组件
在此类中GetHeight
  1. 函数
  2. GetHeight
  3. GetSteepness
  4. GetHeights
  5. SetHeights
  6. SetHeight
  7. GetNormal
  8. GetSlope
  9. GetContour
  10. 属性
  11. Enabled
  12. GameObject
成员 10
函数GetHeightGet an interpolated height at a point x,y.
函数GetSteepnessGet the gradient of the terrain at point (x,y).
函数GetHeightsReturns a two dimensional array of heightmap samples.
函数SetHeightsSets heightmap data using a two dimensional array of heightmap samples.
函数SetHeightSet value to height of [x,y]
函数GetNormalGet an interpolated normal at a given location.
函数GetSlopeGet a normalized and interpolated normal at a given location.
函数GetContourGet a contour of interpolated normal at a given location.
属性EnabledIs the Terrain component enabled?
属性GameObjectThe GameObject that this Terrain component is added to.

函数​

GetHeight​

float GetHeight(float x, float y)

Get an interpolated height at a point x,y.

参数

名称类型默认值
xfloat–
yfloat–

返回值

float

示例

Lua
floatHeight = Space.Host.ExecutingObject.Terrain.GetHeight(1,1)

GetSteepness​

float GetSteepness(float x, float y)

Get the gradient of the terrain at point (x,y).

参数

名称类型默认值
xfloat–
yfloat–

返回值

float

示例

Lua
floatSteepness = Space.Host.ExecutingObject.Terrain.GetSteepness(1,1)

GetHeights​

float[,] 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[,]

示例

Lua
tableHeights = Space.Host.ExecutingObject.Terrain.GetHeights()

SetHeights​

void SetHeights(float[,] data)

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].

参数

名称类型默认值
datafloat[,]–

返回值

void

示例

Lua
tableHeights = Space.Host.ExecutingObject.Terrain.SetHeights({{1,2},{1,2}})

SetHeight​

void SetHeight(int x, int y, float value)

Set value to height of [x,y]

参数

名称类型默认值
xint–
yint–
valuefloat–

返回值

void

示例

Lua
Space.Host.ExecutingObject.Terrain.SetHeight(1,1,0.11)

GetNormal​

SVector GetNormal(float x, float y)

Get an interpolated normal at a given location.

参数

名称类型默认值
xfloat–
yfloat–

返回值

SVector

示例

Lua
vectorNormal = Space.Host.ExecutingObject.Terrain.GetNormal(1,1)

GetSlope​

SVector GetSlope(float x, float y)

Get a normalized and interpolated normal at a given location.

参数

名称类型默认值
xfloat–
yfloat–

返回值

SVector

示例

Lua
vectorSlope = Space.Host.ExecutingObject.Terrain.GetSlope(1,1)

GetContour​

SVector GetContour(float x, float y)

Get a contour of interpolated normal at a given location.

参数

名称类型默认值
xfloat–
yfloat–

返回值

SVector

示例

Lua
vectorContour = Space.Host.ExecutingObject.Terrain.GetContour(1,1)

属性​

Enabled​

bool Enabled {get; set; }

Is the Terrain component enabled?

示例

Lua
Space.Host.ExecutingObject.Terrain.Enabled = false

GameObject只读​

SGameObject GameObject {get; }

The GameObject that this Terrain component is added to.

示例

Lua
theGameObject = Space.Host.ExecutingObject.Terrain.GameObject