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

SizeVec2World footprint (metres) on the XZ plane.
MaxHeightfloatWorld height mapped to a full-strength sample.
ResolutionintSamples per side; Heights is Resolution×Resolution.
Heightsstd::vector<float>Row-major height field [z*Resolution + x], 0..MaxHeight.
EnabledboolMaster switch.

Texture layers

LayersTerrainLayer[4]Each references a .tmaterial plus a per-layer Tiling.
LayerCountintHow many layers are active (1–4).
SplatDatastd::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

PhysicsEnabledboolGenerate 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

SizeVec2Powierzchnia w świecie (metry) w płaszczyźnie XZ.
MaxHeightfloatWysokość w świecie odpowiadająca pełnej próbce.
ResolutionintPróbki na bok; Heights ma Resolution×Resolution.
Heightsstd::vector<float>Wysokości wierszami [z*Resolution + x], 0..MaxHeight.
EnabledboolGłówny przełącznik.

Warstwy tekstur

LayersTerrainLayer[4]Każda wskazuje .tmaterial i ma własny Tiling.
LayerCountintIle warstw jest aktywnych (1–4).
SplatDatastd::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

PhysicsEnabledboolGeneruj statyczny collider heightfield Jolt po Play.

Powiązane