Constructors
Terrain() Properties
| Name | Type | Description |
|---|---|---|
EnableCollision | Boolean | |
IsConcave virtual | Boolean | |
Storage | TerrainStorage | |
MaterialOverride | Material | |
TerrainSize | Single | Uniform world size of the width and length of the terrain. |
TerrainHeight | Single | World size of the maximum height of the terrain. |
ClipMapLodLevels | Int32 | |
ClipMapLodExtentTexels | Int32 | |
SubdivisionFactor | Int32 | |
SubdivisionLodCount | Int32 | |
RenderType | ShadowRenderType | |
HeightMap | Texture | |
ControlMap | Texture | |
ComponentVersion virtual | Int32 |
Methods
Void Create() Call on enable or storage change
Boolean RayIntersects(Ray ray, Single distance, Vector3 position) Given a world ray, finds out the LOCAL position it intersects with this terrain.
Void SyncCPUTexture(SyncFlags flags, RectInt region) Downloads dirty regions from the GPU texture maps onto the CPU, updating collider data and making changes saveable. This is used from the editor after modifying.
Void SyncGPUTexture() Updates the GPU texture maps with the CPU data
TerrainMaterialInfo? GetMaterialAtWorldPosition(Vector3 worldPosition) Gets terrain material information at a world position. Returns null if the position is outside terrain bounds.
Void UpdateMaterialsBuffer() Upload the Materials buffer, this should be called when materials are added, removed or modified.