TerrainComponent struct in Thread
A heightfield terrain: a grid of height samples rendered as a 4×4 chunk grid with
distance-based LOD, painted with up to four texture layers via per-vertex splat weights.
Sculpt and paint it with the editor's Terrain panel. On Play it can generate a static
heightfield collider so things stand on it.
For overhangs, caves or undercut cliffs a heightfield can't represent, model
the terrain as a mesh and give it a
MeshColliderComponent
instead.
Geometry
| Size | Vec2 | World footprint (metres) on the XZ plane. |
| MaxHeight | float | World height mapped to a full-strength sample. |
| Resolution | int | Samples per side; Heights is Resolution×Resolution. |
| Heights | std::vector<float> | Row-major height field [z*Resolution + x], 0..MaxHeight. |
| Enabled | bool | Master switch. |
Texture layers
| Layers | TerrainLayer[4] | Each references a .tmaterial plus a per-layer Tiling. |
| LayerCount | int | How many layers are active (1–4). |
| SplatData | std::vector<uint8_t> | RGBA weight per vertex (R=layer0 … A=layer3). |
Each TerrainLayer has Name, MaterialAssetPath
(a .tmaterial), and Tiling — so one Grass material can repeat 30× on
the terrain and 2× on a wall without conflict.
Physics
| PhysicsEnabled | bool | Generate a static Jolt heightfield collider on Play. |
Related
TerrainComponent struct w Thread
Teren z mapy wysokości: siatka próbek wysokości renderowana jako siatka 4×4 fragmentów z LOD
zależnym od odległości, malowana maksymalnie czterema warstwami tekstur przez wagi per
wierzchołek. Rzeźbisz i malujesz go w panelu Terrain edytora. Po Play może wygenerować statyczny
collider heightfield, żeby obiekty na nim stały.
Nawisy, jaskinie czy podcięte klify, których heightfield nie odwzoruje, zrób jako
siatkę z
MeshColliderComponent.
Geometria
| Size | Vec2 | Powierzchnia w świecie (metry) w płaszczyźnie XZ. |
| MaxHeight | float | Wysokość w świecie odpowiadająca pełnej próbce. |
| Resolution | int | Próbki na bok; Heights ma Resolution×Resolution. |
| Heights | std::vector<float> | Wysokości wierszami [z*Resolution + x], 0..MaxHeight. |
| Enabled | bool | Główny przełącznik. |
Warstwy tekstur
| Layers | TerrainLayer[4] | Każda wskazuje .tmaterial i ma własny Tiling. |
| LayerCount | int | Ile warstw jest aktywnych (1–4). |
| SplatData | std::vector<uint8_t> | Waga RGBA na wierzchołek (R=warstwa0 … A=warstwa3). |
Każda TerrainLayer ma Name, MaterialAssetPath
(.tmaterial) i Tiling — więc jeden materiał trawy może się powtarzać 30×
na terenie i 2× na ścianie bez konfliktu.
Fizyka
| PhysicsEnabled | bool | Generuj statyczny collider heightfield Jolt po Play. |
Powiązane