Hilfe
Parameter
Terrain | Identität eines Terrains |
X# | Globale Weltkoordinate X |
Y# | Globale Weltkoordinate Y |
Z# | Globale Weltkoordinate Z |
Rückgabewert
Es wird die interpolierte Z-Koordinate des Terrains zurückgeliefert.
Beschreibung
Die Funktion TerrainZ liefert die interpolierte Z-Koordinate auf einem Terrain. Dies ist meistens nur dann sinnvoll, wenn das Terrain gedreht ist
Beispiel
Dieses Programm zeigt, dass Unterschiede zwischen EntityXYZ und TerrainXYZ bestehen:
Graphics3D 640, 480
SetBuffer BackBuffer()
camera = CreateCamera()
PositionEntity camera, 1, 1, 1
light = CreateLight()
RotateEntity light, 90, 0, 0
terrain = LoadTerrain("media\001.bmp")
ScaleEntity terrain, 1, 50, 1
grass_tex = LoadTexture("media\002.bmp")
EntityTexture terrain, grass_tex, 0, 1
terra_detail = 4000
vertex_morph = True
While Not KeyDown(1)
If KeyHit(57) = True Then vertex_morph = 1 - vertex_morph
If KeyHit(28) Then terra_shad = 1 - terra_shad
If KeyDown(2) Then terra_detail = terra_detail - 10
If KeyDown(3) Then terra_detail = terra_detail + 10
If KeyDown(203) =True Then x# = x# - 0.1
If KeyDown(205) = True Then x# = x# + 0.1
If KeyDown(208) = True Then y# = y# - 0.1
If KeyDown(200) = True Then y# = y# + 0.1
If KeyDown(44) = True Then z# = z# - 0.1
If KeyDown(30) = True Then z# = z# + 0.1
If KeyDown(205) = True Then TurnEntity camera, 0, - 1, 0
If KeyDown(203) = True Then TurnEntity camera, 0, 1, 0
If KeyDown(208) = True Then MoveEntity camera, 0, 0, - 0.1
If KeyDown(200) = True Then MoveEntity camera, 0, 0, 0.1
TerrainDetail terrain, terra_detail, vertex_morph
TerrainShading terrain, terra_shad
x# = EntityX(camera)
y# = EntityY(camera)
z# = EntityZ(camera)
terra_y# = TerrainY(terrain, x#, y#, z#) + 5
PositionEntity camera, x#, terra_y#, z#
x# = EntityX(camera)
y# = EntityY(camera)
z# = EntityZ(camera)
RenderWorld
Text 0, 0, "Benutze Cursortasten"
Text 0, 40, "X:" + x#
Text 0, 60, "Y:" + y#
Text 0, 80, "Z:" + z#
Text 150, 40, "TERRAINX:" + TerrainX(terrain, x#, y#, z#)
Text 150, 60, "TERRAINY:" + TerrainY(terrain, x#, y#, z#)
Text 150, 80, "TERRAINZ:" + TerrainZ(terrain, x#, y#, z#)
Flip
Wend
End

