API:Class/Terrain

This page is about the type "Terrain" and its members. For the property through which such an object can be obtained, see Workspace.Terrain. For other uses, see Terrain (disambiguation).


Filtered-inheritance mode: While this class technically inherits all Instance class members, some (if not all) have been hidden because they serve no purpose for this object.
Uncreatable: This object cannot be created with Instance.new.

Terrain icon.pngTerrain : Object Icon.pngBasePart : Object Icon.pngPVInstance : Object Icon.pngInstance

Terrain is a feature that allows players to create dynamically morphable environments, with little to no lag. Terrain is currently based on a 4x4x4 grid of cells, where each cell has a number between 0 and 1 representing how much the geometry should occupy the cell, and the material of the cell. The occupancy determines how the cell will morph together with surrounding cells, and the result is the illusion of having no grid constraint. Terrain provides a practically unlimited amount of space to work with.

While Terrain inherits from the Object Icon.pngBasePart class, most of the inherited properties and methods will have no effect on the Terrain object, so they have been hidden from this page. The only exception to this is the Touched event, and TouchEnded event.

Properties

PropertiesmemberhiddenProperties [toggle]

Region3int16MaxExtents [readonly]

Displays the boundaries of the largest possible editable region.

|RMD member="API:Class/Terrain/MaxExtents"|Displays the boundaries of the largest possible editable region.|/RMD|
Color3WaterColor

The tint of the Terrain water.

|RMD member="API:Class/Terrain/WaterColor"|The tint of the Terrain water.|/RMD|
floatWaterReflectance

Controls how opaque the Terrain's water reflections are.

|RMD member="API:Class/Terrain/WaterReflectance"|Controls how opaque the Terrain's water reflections are.|/RMD|
floatWaterTransparency

The transparency of the Terrain water.

|RMD member="API:Class/Terrain/WaterTransparency"|The transparency of the Terrain water.|/RMD|
floatWaterWaveSize

Sets the maximum height of the Terrain water waves in studs.

|RMD member="API:Class/Terrain/WaterWaveSize"|Sets the maximum height of the Terrain water waves in studs.|/RMD|
floatWaterWaveSpeed

Sets how many times the Terrain water waves will move up and down per minute.

|RMD member="API:Class/Terrain/WaterWaveSpeed"|Sets how many times the Terrain water waves will move up and down per minute.|/RMD|
boolIsSmooth [deprecated] [readonly]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/IsSmooth"|Deprecated. Do not use.|/RMD|
MaxExtents [readonly]
Displays the boundaries of the largest possible editable region.
The tint of the Terrain water.
Controls how opaque the Terrain's water reflections are.
The transparency of the Terrain water.
Sets the maximum height of the Terrain water waves in studs.
Sets how many times the Terrain water waves will move up and down per minute.
IsSmooth [deprecated] [readonly]
Deprecated. Do not use.
Inherited from Object Icon.pngPVInstance:
CFrameCoordinateFrame [deprecated] [unscriptable] [writeonly]

Deprecated. Do not use.

|RMD member="API:Class/PVInstance/CoordinateFrame"|Deprecated. Do not use.|/RMD|
CoordinateFrame [deprecated] [unscriptable] [writeonly]
Deprecated. Do not use.

Functions

FunctionsmemberhiddenFunctions [toggle]

Vector3CellCenterToWorld ( int x, int y, int z )

Returns the world position of the center of the terrain cell (x, y, z).

|RMD member="API:Class/Terrain/CellCenterToWorld"|Returns the world position of the center of the terrain cell (x, y, z).|/RMD|
Vector3CellCornerToWorld ( int x, int y, int z )

Returns the position of the lower-left-forward corner of the grid cell (x, y, z).

|RMD member="API:Class/Terrain/CellCornerToWorld"|Returns the position of the lower-left-forward corner of the grid cell (x, y, z).|/RMD|
voidClear ( )

Clears the terrain.

|RMD member="API:Class/Terrain/Clear"|Clears the terrain.|/RMD|
TerrainRegionCopyRegion ( Region3int16 region )

Stores a chunk of terrain into a TerrainRegion object so it can be loaded back later. Note: TerrainRegion data does not replicate between server and client.

|RMD member="API:Class/Terrain/CopyRegion"|Stores a chunk of terrain into a TerrainRegion object so it can be loaded back later. Note: TerrainRegion data does not replicate between server and client.|/RMD|
intCountCells ( )

Returns the number of non-empty cells in the Terrain.

|RMD member="API:Class/Terrain/CountCells"|Returns the number of non-empty cells in the Terrain.|/RMD|
voidFillBall ( Vector3 center, float radius, Material material )

Fills a ball of smooth terrain in a given space.

|RMD member="API:Class/Terrain/FillBall"|Fills a ball of smooth terrain in a given space.|/RMD|
voidFillBlock ( CFrame cframe, Vector3 size, Material material )

Fills a block of smooth terrain with a given location, rotation, size, and material.

|RMD member="API:Class/Terrain/FillBlock"|Fills a block of smooth terrain with a given location, rotation, size, and material.|/RMD|
voidFillRegion ( Region3 region, float resolution, Material material )

Fills a Region3 space with smooth terrain.

|RMD member="API:Class/Terrain/FillRegion"|Fills a Region3 space with smooth terrain.|/RMD|
voidPasteRegion ( TerrainRegion region, Vector3int16 corner, bool pasteEmptyCells )

Applies a chunk of terrain to the Terrain object. Note: TerrainRegion data does not replicate between server and client.

|RMD member="API:Class/Terrain/PasteRegion"|Applies a chunk of terrain to the Terrain object. Note: TerrainRegion data does not replicate between server and client.|/RMD|
array<array<array<Material>>>, array<array<array<float>>>ReadVoxels ( Region3 region, float resolution )

Returns a certain region of smooth terrain in table format. Both of the return arrays have an additional .Size property, a Vector3.

|RMD member="API:Class/Terrain/ReadVoxels"|Returns a certain region of smooth terrain in table format. Both of the return arrays have an additional .Size property, a Vector3.|/RMD|
Vector3WorldToCell ( Vector3 position )

Returns the grid cell location that contains the point position.

|RMD member="API:Class/Terrain/WorldToCell"|Returns the grid cell location that contains the point position.|/RMD|
Vector3WorldToCellPreferEmpty ( Vector3 position )

Returns the grid cell location that contains the point position, preferring empty grid cells when position is on a grid edge.

|RMD member="API:Class/Terrain/WorldToCellPreferEmpty"|Returns the grid cell location that contains the point position, preferring empty grid cells when position is on a grid edge.|/RMD|
Vector3WorldToCellPreferSolid ( Vector3 position )

Returns the grid cell location that contains the point position, preferring non-empty grid cells when position is on a grid edge.

|RMD member="API:Class/Terrain/WorldToCellPreferSolid"|Returns the grid cell location that contains the point position, preferring non-empty grid cells when position is on a grid edge.|/RMD|
voidWriteVoxels ( Region3 region, float resolution, array<array<array<Material>>> materials, array<array<array<float>>> occupancy )

Sets a certain region of smooth terrain using the table format.

|RMD member="API:Class/Terrain/WriteVoxels"|Sets a certain region of smooth terrain using the table format.|/RMD|
boolAutowedgeCell ( int x, int y, int z ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/AutowedgeCell"|Deprecated. Do not use.|/RMD|
voidAutowedgeCells ( Region3int16 region ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/AutowedgeCells"|Deprecated. Do not use.|/RMD|
voidConvertToSmooth ( ) [PluginSecurity] [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/ConvertToSmooth"|Deprecated. Do not use.|/RMD|
TupleGetCell ( int x, int y, int z ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/GetCell"|Deprecated. Do not use.|/RMD|
TupleGetWaterCell ( int x, int y, int z ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/GetWaterCell"|Deprecated. Do not use.|/RMD|
voidSetCell ( int x, int y, int z, CellMaterial material, CellBlock block, CellOrientation orientation ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/SetCell"|Deprecated. Do not use.|/RMD|
voidSetCells ( Region3int16 region, CellMaterial material, CellBlock block, CellOrientation orientation ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/SetCells"|Deprecated. Do not use.|/RMD|
voidSetWaterCell ( int x, int y, int z, WaterForce force, WaterDirection direction ) [deprecated]

Deprecated. Do not use.

|RMD member="API:Class/Terrain/SetWaterCell"|Deprecated. Do not use.|/RMD|
Returns the world position of the center of the terrain cell (x, y, z).
Returns the position of the lower-left-forward corner of the grid cell (x, y, z).
Clear ( )
Clears the terrain.
Stores a chunk of terrain into a TerrainRegion object so it can be loaded back later. Note: TerrainRegion data does not replicate between server and client.
Returns the number of non-empty cells in the Terrain.
FillBall ( Vector3 center, float radius, Material material )
Fills a ball of smooth terrain in a given space.
FillBlock ( CFrame cframe, Vector3 size, Material material )
Fills a block of smooth terrain with a given location, rotation, size, and material.
FillRegion ( Region3 region, float resolution, Material material )
Fills a Region3 space with smooth terrain.
PasteRegion ( TerrainRegion region, Vector3int16 corner, bool pasteEmptyCells )
Applies a chunk of terrain to the Terrain object. Note: TerrainRegion data does not replicate between server and client.
ReadVoxels ( Region3 region, float resolution )
Returns a certain region of smooth terrain in table format. Both of the return arrays have an additional .Size property, a Vector3.
WorldToCell ( Vector3 position )
Returns the grid cell location that contains the point position.
Returns the grid cell location that contains the point position, preferring empty grid cells when position is on a grid edge.
Returns the grid cell location that contains the point position, preferring non-empty grid cells when position is on a grid edge.
WriteVoxels ( Region3 region, float resolution, array<array<array<Material>>> materials, array<array<array<float>>> occupancy )
Sets a certain region of smooth terrain using the table format.
AutowedgeCell ( int x, int y, int z ) [deprecated]
Deprecated. Do not use.
AutowedgeCells ( Region3int16 region ) [deprecated]
Deprecated. Do not use.
ConvertToSmooth ( ) [PluginSecurity] [deprecated]
Deprecated. Do not use.
GetCell ( int x, int y, int z ) [deprecated]
Deprecated. Do not use.
GetWaterCell ( int x, int y, int z ) [deprecated]
Deprecated. Do not use.
SetCell ( int x, int y, int z, CellMaterial material, CellBlock block, CellOrientation orientation ) [deprecated]
Deprecated. Do not use.
SetCells ( Region3int16 region, CellMaterial material, CellBlock block, CellOrientation orientation ) [deprecated]
Deprecated. Do not use.
SetWaterCell ( int x, int y, int z, WaterForce force, WaterDirection direction ) [deprecated]
Deprecated. Do not use.
Inherited from Object Icon.pngInstance:
RBXScriptSignalGetPropertyChangedSignal ( string property )

Returns a signal that is fired when the specified property is changed on this object.

|RMD member="API:Class/Instance/GetPropertyChangedSignal"|Returns a signal that is fired when the specified property is changed on this object.|/RMD|
Returns a signal that is fired when the specified property is changed on this object.


Events

Events [toggle]

Inherited from Object Icon.pngBasePart:
TouchEnded ( BasePart otherPart )

Fired when otherPart stops touching this object.

|RMD member="API:Class/BasePart/TouchEnded"|Fired when otherPart stops touching this object.|/RMD|
Touched ( BasePart otherPart )

Fired when another object comes in contact with this object.

|RMD member="API:Class/BasePart/Touched"|Fired when another object comes in contact with this object.|/RMD|
TouchEnded ( BasePart otherPart )
Fired when otherPart stops touching this object.
Touched ( BasePart otherPart )
Fired when another object comes in contact with this object.
Inherited from Object Icon.pngInstance:
Changed ( string property )

Fires after a property of the object changes.

|RMD member="API:Class/Instance/Changed"|Fires after a property of the object changes.|/RMD|
Changed ( string property )
Fires after a property of the object changes.

|RMD member="API:Class/Terrain"|Terrain is a feature that allows players to create dynamically morphable environments, with little to no lag. Terrain is currently based on a 4x4x4 grid of cells, where each cell has a number between 0 and 1 representing how much the geometry should occupy the cell, and the material of the cell. The occupancy determines how the cell will morph together with surrounding cells, and the result is the illusion of having no grid constraint. Terrain provides a practically unlimited amount of space to work with. While Terrain inherits from the Object Icon.pngBasePart class, most of the inherited properties and methods will have no effect on the Terrain object, so they have been hidden from this page. The only exception to this is the Touched event, and TouchEnded event. |/RMD|