Breakroom is now Sinewave Campus. Book a meeting

STerrain

ClientComposants
Dans cette classeGetHeight
  1. Fonctions
  2. GetHeight
  3. GetSteepness
  4. GetHeights
  5. SetHeights
  6. SetHeight
  7. GetNormal
  8. GetSlope
  9. GetContour
  10. Propriétés
  11. Enabled
  12. GameObject
Membres 10
FonctionGetHeightGet an interpolated height at a point x,y.
FonctionGetSteepnessGet the gradient of the terrain at point (x,y).
FonctionGetHeightsReturns a two dimensional array of heightmap samples.
FonctionSetHeightsSets heightmap data using a two dimensional array of heightmap samples.
FonctionSetHeightSet value to height of [x,y]
FonctionGetNormalGet an interpolated normal at a given location.
FonctionGetSlopeGet a normalized and interpolated normal at a given location.
FonctionGetContourGet a contour of interpolated normal at a given location.
PropriétéEnabledIs the Terrain component enabled?
PropriétéGameObjectThe GameObject that this Terrain component is added to.

Fonctions​

GetHeight​

float GetHeight(float x, float y)

Get an interpolated height at a point x,y.

Paramètres

NomTypeValeur par défaut
xfloat–
yfloat–

Valeurs de retour

float

Exemple

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

Paramètres

NomTypeValeur par défaut
xfloat–
yfloat–

Valeurs de retour

float

Exemple

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

Valeurs de retour

float[,]

Exemple

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

Paramètres

NomTypeValeur par défaut
datafloat[,]–

Valeurs de retour

void

Exemple

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]

Paramètres

NomTypeValeur par défaut
xint–
yint–
valuefloat–

Valeurs de retour

void

Exemple

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.

Paramètres

NomTypeValeur par défaut
xfloat–
yfloat–

Valeurs de retour

SVector

Exemple

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.

Paramètres

NomTypeValeur par défaut
xfloat–
yfloat–

Valeurs de retour

SVector

Exemple

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.

Paramètres

NomTypeValeur par défaut
xfloat–
yfloat–

Valeurs de retour

SVector

Exemple

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

Propriétés​

Enabled​

bool Enabled {get; set; }

Is the Terrain component enabled?

Exemple

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

GameObjectLecture seule​

SGameObject GameObject {get; }

The GameObject that this Terrain component is added to.

Exemple

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