Open Asterune
Terrain

Terrain

Stores and edits voxel terrain and water.

Not creatable
Created by the engine or used as a base class.
Inherits
BasePartPVInstanceInstance
Replication
Standard

Behavior

Terrain stores and edits voxel terrain and water.

Summary

Members46
Properties8
Methods38

Properties

Decoration

Terrain.Decoration: boolean

Whether terrain decoration is displayed.

GrassLength

Terrain.GrassLength: number

The rendered length of terrain grass.

MaxExtents

Terrain.MaxExtents: Region3int16

The terrain's cell-coordinate bounds.

WaterColor

Terrain.WaterColor: Color3

The base color used to render water.

WaterReflectance

Terrain.WaterReflectance: number

The reflectivity used to render water.

WaterTransparency

Terrain.WaterTransparency: number

The transparency used to render water.

WaterWaveSize

Terrain.WaterWaveSize: number

The amplitude used for rendered water waves.

WaterWaveSpeed

Terrain.WaterWaveSpeed: number

The speed used for rendered water waves.

Methods

CellCenterToWorld

Terrain:CellCenterToWorld(Vector3): Vector3

Returns the world-space center of a terrain cell.

CellCornerToWorld

Terrain:CellCornerToWorld(Vector3): Vector3

Returns the world-space minimum corner of a terrain cell.

Clear

Terrain:Clear(): ()

Removes all terrain cells.

ClearRegionAsync

Terrain:ClearRegionAsync(region: Region3): TerrainJob

Queues clearing of a region and returns a TerrainJob.

ClearWater

Terrain:ClearWater(Region3): number

Removes water from the supplied region.

CopyRegion

Terrain:CopyRegion(region: Region3): TerrainRegion

Copies terrain into a TerrainRegion. Copying more than 16777216 cells at once causes an error.

CountCells

Terrain:CountCells(): number

Returns the number of occupied terrain cells.

FillBall

Terrain:FillBall(center: Vector3, radius: number, material: EnumItem): ()

Fills a sphere at the world-space center with the specified terrain material. Radius is in studs.

FillBlock

Terrain:FillBlock(cframe: CFrame, size: Vector3, material: EnumItem): ()

Fills an oriented box with the specified terrain material. The transform and dimensions are in world space.

FillCapsule

Terrain:FillCapsule(from: Vector3, to: Vector3, radius: number, material: EnumItem): ()

Fills a capsule with the specified terrain material.

FillCylinder

Terrain:FillCylinder(cframe: CFrame, height: number, radius: number, material: EnumItem): ()

Fills a cylinder with the specified terrain material.

FillRegion

Terrain:FillRegion(region: Region3, resolution: number?, material: EnumItem): ()

Fills the supplied world-space region with the specified terrain material.

FillRegionAsync

Terrain:FillRegionAsync(region: Region3, resolution: number?, material: EnumItem): TerrainJob

Queues filling of a region and returns a TerrainJob.

FillWater

Terrain:FillWater(Region3, number?): number

Fills the supplied region with water.

FillWedge

Terrain:FillWedge(cframe: CFrame, size: Vector3, material: EnumItem): ()

Fills a wedge with the specified terrain material.

Generate

Terrain:Generate(Region3, table?): number

Generates terrain using the supplied region and generation options.

GenerateAsync

Terrain:GenerateAsync(region: Region3, options: { [string]: any }?): TerrainJob

Queues terrain generation and returns a TerrainJob.

GetCell

Terrain:GetCell(number, number, number): EnumItem, EnumItem, EnumItem

Returns the cell material, block shape, and orientation. The current binding returns NegZ for orientation.

GetHeight

Terrain:GetHeight(number, number): number?

Returns the terrain surface height at the supplied world-space X and Z coordinates, or nil when no surface is found.

GetMaterialColor

Terrain:GetMaterialColor(EnumItem): Color3

Returns the terrain color override for the specified material.

GetMaterialVariant

Terrain:GetMaterialVariant(material: EnumItem): string?

Returns the variant name assigned to a terrain material, or nil when no override exists.

GetWaterCell

Terrain:GetWaterCell(number, number, number): EnumItem, EnumItem

Returns the cell's water-force and direction values. This binding reports water presence through the force value and returns NegX for direction.

GetWaterDepth

Terrain:GetWaterDepth(Vector3): number

Returns the water depth at the supplied world-space position. Returns zero when no water depth is available.

ImportHeightmap

Terrain:ImportHeightmap(Region3, string, string?, EnumItem?): number

Imports a heightmap image into the supplied region. Accepts an optional colormap image and material. The default material is Grass. Unreadable or invalid image data causes an error.

PasteRegion

Terrain:PasteRegion(region: TerrainRegion, corner: Vector3, pasteEmptyCells: boolean?): number

Pastes a TerrainRegion at the supplied cell corner. The corner is rounded to integer cell coordinates. paste_empty defaults to true.

ReadVoxels

Terrain:ReadVoxels(Region3, number?): table, table

Returns material and occupancy arrays indexed as [x][y][z], with one-based indices. Occupancy is normalized from 0 to 1. Reading more than 4194304 cells at once causes an error.

ReplaceMaterial

Terrain:ReplaceMaterial(region: Region3, resolution: number?, sourceMaterial: EnumItem, targetMaterial: EnumItem): ()

Replaces occupied cells of the selected material within the region. Other materials and cell occupancy are preserved.

ReplaceMaterialAsync

Terrain:ReplaceMaterialAsync(region: Region3, resolution: number?, sourceMaterial: EnumItem, targetMaterial: EnumItem): TerrainJob

Queues material replacement within a region and returns a TerrainJob.

Sculpt

Terrain:Sculpt(string, Vector3, number, table?): number

Edits terrain with Add, Subtract, Grow, Erode, Smooth, Flatten, Paint, Replace, Flood, or Drain and returns the changed-cell count. Center and radius must be finite; radius must be positive and is capped at 512 studs. Brush Shape accepts Sphere, Cube, or Cylinder. Replace requires From; Flatten accepts PlanePosition, PlaneNormal, and FlattenMode.

SetCell

Terrain:SetCell(x: number, y: number, z: number, material: EnumItem, block: EnumItem?, orientation: EnumItem?): ()

Sets a cell's material and optional block shape. The orientation argument is accepted but is not applied by the current binding.

SetCells

Terrain:SetCells(region: Region3, material: EnumItem, block: EnumItem?, orientation: EnumItem?): ()

Sets cells within the region to the supplied material and optional block shape. The orientation argument is accepted but is not applied by the current binding.

SetMaterialColor

Terrain:SetMaterialColor(material: EnumItem, value: Color3): ()

Sets the terrain color override for the specified material.

SetMaterialVariant

Terrain:SetMaterialVariant(material: EnumItem, variant: string?): ()

Assigns a variant name to a terrain material. Pass nil or an empty string to remove the override.

WorldToCell

Terrain:WorldToCell(Vector3): Vector3

Converts a world-space position to terrain-cell coordinates.

WorldToCellPreferEmpty

Terrain:WorldToCellPreferEmpty(Vector3): Vector3

Converts a world-space position to cell coordinates with a preference for an adjacent empty cell.

WorldToCellPreferSolid

Terrain:WorldToCellPreferSolid(Vector3): Vector3

Converts a world-space position to cell coordinates with a preference for an adjacent occupied cell.

WriteVoxels

Terrain:WriteVoxels(region: Region3, resolution: number?, materials: { { { EnumItem } } }, occupancy: { { { number } } }): ()

Writes material and occupancy arrays indexed as [x][y][z]. The arrays must cover the cell dimensions of the supplied region.

WriteVoxelsAsync

Terrain:WriteVoxelsAsync(region: Region3, resolution: number?, materials: { { { EnumItem } } }, occupancy: { { { number } } }): TerrainJob

Queues writing voxel arrays and returns a TerrainJob.

Inherited members

Inherited111
Properties
AnchoredAngularVelocityBackSurfaceBottomSurfaceCanCollideCanQueryCanSeparateCanTouchCastShadowCenterOfMassCFrameCollisionFidelityCollisionGroupColorCoordinateFrameCustomPhysicalPropertiesElasticityFaceCountFrictionFrontSurfaceGravityScaleLeftSurfaceLinearVelocityLockedMassMasslessMaterialMaterialSetMaterialVariantPositionReflectanceRenderLayerRightSurfaceRotationShapeSizeSmoothingAngleTextureIdTopSurfaceTransparencyTriangleCountVertexCountVisibilityMask
Methods
ApplyAngularImpulse()ApplyImpulse()ApplyImpulseAtPosition()GetContacts()GetExecutionGroup()GetMass()GetMesh()GetNetworkOwner()GetNetworkOwnershipAuto()GetTouchingParts()GetVelocityAtPosition()Intersect()MakeEditable()Separate()SetMesh()SetNetworkOwner()SetNetworkOwnershipAuto()Subtract()Union()
Events
TouchedTouchEnded
Properties
ArchivableClassNameNameParent
Methods
AddComponent()AddTag()ClearAllChildren()ClearTags()Clone()Destroy()FindFirstAncestor()FindFirstAncestorOfClass()FindFirstAncestorWhichIsA()FindFirstChild()FindFirstChildOfClass()FindFirstChildWhichIsA()FindFirstDescendant()GetAttribute()GetAttributeChangedSignal()GetAttributes()GetChildren()GetComponent()GetComponentChangedSignal()GetComponents()GetDebugId()GetDescendants()GetFullName()GetPropertyChangedSignal()GetReferencing()GetTags()HasComponent()HasTag()IsA()IsAncestorOf()IsDescendantOf()RemoveComponent()RemoveTag()SetAttribute()WaitForChild()
Events
AncestryChangedAttributeChangedChangedChildAddedChildRemovedDescendantAddedDescendantRemovingDestroying

BasePart