Skip to content

Commit 5678e1a

Browse files
author
Roberto De Ioris
authored
Update Landscape_API.md
1 parent 56ac63d commit 5678e1a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

docs/Landscape_API.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,29 @@ Note that you need to carefully choose the size of the terrain as well as the he
104104
https://docs.unrealengine.com/latest/INT/Engine/Landscape/TechnicalGuide/index.html#calculatingheightmapdimensions
105105

106106

107+
## Getting/Creating ULandscapeInfo
108+
109+
Informations about a Landscape/Terrain are stored in a special uobject called ULandscapeInfo.
110+
111+
To retrieve it (or eventually create a new one), you have the following two functions:
112+
113+
```python
114+
landscape_info = landscape.get_landscape_info()
115+
116+
# create a new ULandscapeInfo, required if you do not import an heightmap in a manually spawned landscape
117+
landscape_info = landscape.create_landscape_info()
118+
```
119+
120+
## Retrieving ULandscapeComponent's textures
121+
122+
If you want to get access to the height values of a terrain, you need to retrieve them from each component:
123+
124+
```python
125+
import unreal_engine as ue
126+
127+
for component in landscape.LandscapeComponents:
128+
heightmap_texture = component.HeightmapTexture
129+
print('{0}x{1} -> {2}'.format(heightmap_texture.texture_get_width(), heightmap_texture.texture_get_height(), len(heightmap_texture.texture_get_source_data())))
130+
```
131+
132+
this will print the texture width, height and data size of each landscape component.

0 commit comments

Comments
 (0)