Terrain [BETA]
Generate and edit runtime Terrain using AeoScript.
terrain.generate(position, size) [BETA]
Generate Terrain for the current Play session using the project's selected Terrain generator.
- Arguments
position: [x, y, z] whole-number world origin.size: [x, y, z] positive whole-number dimensions.- Returns
nilon success.- Works with
Runtime Terrain and the active project's Terrain generator settings.
- Missing values and errors
Inputs must be finite 32-bit integers; dimensions must be positive; the request must stay within Terrain's 16,777,216-volume limit. Invalid generator settings report an error.
The generated Terrain lasts for the current Play session.
terrain.generate([0, 0, 0], [64, 32, 64])terrain.set_voxels(origin, size, materials, voxels[, spacing_studs]) [BETA]
Create a dense, smooth-voxel Terrain volume during Play.
- Arguments
origin: [x, y, z] integer world position.size: [x, y, z] positive logical sample counts.materials: basket of material strings.voxels: flat basket of [material_index, occupancy] samples ordered X-fastest, then Z, then Y. Optionalspacing_studs: positive finite number of studs per sample (default 4).- Returns
nilon success.- Works with
Runtime Terrain.
- Missing values and errors
Voxel count must equal size.x × size.y × size.z. Material indices start at zero; occupancy is in [0, 1]. Invalid dimensions, palette indices, spacing or world bounds report an error.
The samples produce runtime Terrain without changing saved project Terrain.
terrain.set_voxels(
[0, 0, 0],
[2, 1, 2],
["grass", "rock"],
[[0, 1.0], [0, 0.65], [1, 1.0], [1, 0.25]]
)terrain.sample_surface(x, z) [BETA]
Read the top Terrain surface at a world position.
- Arguments
Finite world X and Z numbers.
- Returns
Map with position, normal, slope_degrees, material_id and source, or nil if none.
- Works with
Runtime Terrain.
- Missing values and errors
Coordinates must be finite and within World range.
Read-only.
const surface = terrain.sample_surface(0, 0)
if surface != nil {
debug.log(surface["slope_degrees"])
}