STerrain
On this classGetHeight
| Function | GetHeight | Get an interpolated height at a point x,y. |
| Function | GetSteepness | Get the gradient of the terrain at point (x,y). |
| Function | GetHeights | Returns a two dimensional array of heightmap samples. |
| Function | SetHeights | Sets heightmap data using a two dimensional array of heightmap samples. |
| Function | SetHeight | Set value to height of [x,y] |
| Function | GetNormal | Get an interpolated normal at a given location. |
| Function | GetSlope | Get a normalized and interpolated normal at a given location. |
| Function | GetContour | Get a contour of interpolated normal at a given location. |
| Property | Enabled | Is the Terrain component enabled? |
| Property | GameObject | The GameObject that this Terrain component is added to. |
Functions
GetHeight
Get an interpolated height at a point x,y.
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
Returns
float
Example
floatHeight = Space.Host.ExecutingObject.Terrain.GetHeight(1,1)
GetSteepness
Get the gradient of the terrain at point (x,y).
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
Returns
float
Example
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].
Returns
float[,]
Example
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].
Parameters
| Name | Type | Default |
|---|---|---|
| data | float[,] | – |
Returns
void
Example
tableHeights = Space.Host.ExecutingObject.Terrain.SetHeights({{1,2},{1,2}})
SetHeight
Set value to height of [x,y]
Parameters
| Name | Type | Default |
|---|---|---|
| x | int | – |
| y | int | – |
| value | float | – |
Returns
void
Example
Space.Host.ExecutingObject.Terrain.SetHeight(1,1,0.11)
GetNormal
Get an interpolated normal at a given location.
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
Returns
SVector
Example
vectorNormal = Space.Host.ExecutingObject.Terrain.GetNormal(1,1)
GetSlope
Get a normalized and interpolated normal at a given location.
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
Returns
SVector
Example
vectorSlope = Space.Host.ExecutingObject.Terrain.GetSlope(1,1)
GetContour
Get a contour of interpolated normal at a given location.
Parameters
| Name | Type | Default |
|---|---|---|
| x | float | – |
| y | float | – |
Returns
SVector
Example
vectorContour = Space.Host.ExecutingObject.Terrain.GetContour(1,1)
Properties
Enabled
Is the Terrain component enabled?
Example
Space.Host.ExecutingObject.Terrain.Enabled = false
GameObjectRead only
The GameObject that this Terrain component is added to.
Example
theGameObject = Space.Host.ExecutingObject.Terrain.GameObject



