TerrainData
Package: Libraries.Game.Graphics.Worlds · Inherits from: Libraries.Language.Object
TerrainData holds all of the heights for a terrain. The heights are split into square regions, each a TerrainRegion, laid side by side like tiles. Only the regions that are added use any memory, so a world can have land in a few places and nothing in between. Heights are found in two ways: 1. By sample. A sample is one point on the ground's grid, numbered across (x) and deep (z) from the world's origin. Sample (0, 0) is at the origin, and samples run into negative numbers on the other side. TerrainData works out which region holds a sample. 2. By world position. The vertex spacing says how far apart the samples are, so a world position is turned into the sample at or just below it. Every change to a height is recorded in the edited area, a rectangle of samples that covers everything changed since the area was last cleared. A terrain uses it to rebuild only the parts of its mesh that changed. The regions sit in a grid of 32 by 32 locations, from -16 to 15 along each axis, so the region at location (0, 0) starts at the origin. With the default region size of 256, the world can be up to 8192 samples across. This class is modeled on Terrain3DData from Terrain3D, which uses the same grid of regions, the same default region size, and the same idea of an edited area.
Example Code
use Libraries.Game.Graphics.Worlds.TerrainData
TerrainData data
data:AddRegion(0, 0)
data:SetHeight(10.5, 20.25, 3)
output data:GetHeight(10.5, 20.25)
Actions
AddRegion(integer locationX, integer locationZ)
This action adds a flat region, with every height 0, at a location. The whole region is added to the edited area.
Parameters
locationXinteger: The region location along x, from -16 to 15.locationZinteger: The region location along z, from -16 to 15.
Returns
Libraries.Game.Graphics.Worlds.TerrainRegion: The new region.
AddToEditedArea(integer minimumX, integer minimumZ, integer maximumX, integer maximumZ)
This action grows the edited area to cover a rectangle of samples.
Parameters
minimumXinteger: The rectangle's smallest sample along x.minimumZinteger: The rectangle's smallest sample along z.maximumXinteger: The rectangle's largest sample along x.maximumZinteger: The rectangle's largest sample along z.
AddToSplatEditedArea(integer minimumX, integer minimumZ, integer maximumX, integer maximumZ)
This action grows the splat edited area to cover a rectangle of samples.
Parameters
minimumXinteger: The rectangle's smallest sample along x.minimumZinteger: The rectangle's smallest sample along z.maximumXinteger: The rectangle's largest sample along x.maximumZinteger: The rectangle's largest sample along z.
BlendRegions(Libraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainRegion> added)
This action sets every height in a group of new regions from the ground around them, so they join the terrain without a step. Each sample looks along x and z, both ways, past the other new regions, to the first ground that was already there. It takes that ground's height at the edge, and counts it more the closer it is. A way with no ground uses the average height of the ground beside the new regions. Next to old ground a new region matches it; away from it, it levels off. Since the group is blended as one, there are no seams between its regions.
Parameters
addedLibraries.Containers.Array<Libraries.Game.Graphics.Worlds.TerrainRegion>: The new regions, already in the region map.
ClearEditedArea()
This action empties the edited area, usually after the terrain has been rebuilt to match the heights.
ClearSplat()
This action sets every sample's splat weights back to the default, all the first layer, and marks every region unpainted, so the next save deletes their splat images. It is for a terrain that no longer has any materials.
ClearSplatEditedArea()
This action empties the splat edited area, usually after the terrain's splat textures have been rebuilt to match.
FoldSplatLayers(integer layerCount, integer minimumX, integer minimumZ, integer maximumX, integer maximumZ)
This action gives the weights of layers a terrain doesn't have to its first layer, over a rectangle of samples, such as after auto paint, which paints four layers, on a terrain with fewer materials.
Parameters
layerCountinteger: How many layers the terrain has, from 1 to 4.minimumXinteger: The rectangle's smallest sample along x.minimumZinteger: The rectangle's smallest sample along z.maximumXinteger: The rectangle's largest sample along x.maximumZinteger: The rectangle's largest sample along z.
ForgetRegionsNotLoaded()
This action takes every region location with no region in memory off the list of saved regions, so the next save's "terrain.json" leaves them out and Load won't bring them back. Their image files are left in the folder, unused; nothing is deleted. It is for terrains kept wholly in memory, like a terrain editor's, where a region missing from memory was removed on purpose. Don't use it while streaming, where most saved regions are not in memory.
Returns
integer: How many regions were taken off the list.
GenerateHeights(Libraries.Compute.Noise.NoiseGenerator noise, integer startX, integer startZ, integer width, integer depth, number heightScale, number offset)
This action fills a rectangle of samples with heights from a noise generator, adding regions wherever they are needed. The noise is read at each sample's number, using the generator's additive noise, so the generator's frequency decides how far apart its hills are in samples. The noise is moved to between 0 and 1, multiplied by the height scale, and then the offset is added to it.
Parameters
noiseLibraries.Compute.Noise.NoiseGenerator: The noise generator to read heights from.startXinteger: The first sample along x.startZinteger: The first sample along z.widthinteger: How many samples to fill along x.depthinteger: How many samples to fill along z.heightScalenumber: What each height from 0 to 1 is multiplied by.offsetnumber: What is added to each height after it is scaled.
GenerateSplatBySlope(integer startX, integer startZ, integer width, integer depth, integer flatChannel, integer slopeChannel, number lowDegrees, number highDegrees)
This action gives a rectangle of samples splat weights by how steep the ground is, like Terrain3D's auto shader. Ground flatter than the low angle gets only the flat texture, ground steeper than the high angle only the slope texture, and in between the two are blended smoothly. Other textures' weights become 0. Samples with no region are skipped.
Parameters
startXinteger: The first sample along x.startZinteger: The first sample along z.widthinteger: How many samples to set along x.depthinteger: How many samples to set along z.flatChannelinteger: The texture for flat ground: 0 red, 1 green, 2 blue, 3 alpha.slopeChannelinteger: The texture for steep ground.lowDegreesnumber: The slope, in degrees from flat, where the slope texture starts.highDegreesnumber: The slope where the flat texture is gone. It must be more than lowDegrees.
GetBlockEdgeHeight(integer minimumX, integer minimumZ, integer maximumX, integer maximumZ)
This action returns the average height of the ground just outside a rectangle of region locations: the samples next to the rectangle's edges that have ground. It is 0 if there is no ground around it. It tells roughly what height new regions in the rectangle would start at.
Parameters
minimumXinteger: The rectangle's first region location along x.minimumZinteger: The rectangle's first region location along z.maximumXinteger: The rectangle's last region location along x.maximumZinteger: The rectangle's last region location along z.
Returns
number: The average height, in world units, or 0.
GetEditedMaximumX()
This action returns the largest sample number along x in the edited area.
Returns
integer: The edited area's largest x, or 0 if there is no edited area.
GetEditedMaximumZ()
This action returns the largest sample number along z in the edited area.
Returns
integer: The edited area's largest z, or 0 if there is no edited area.
GetEditedMinimumX()
This action returns the smallest sample number along x in the edited area.
Returns
integer: The edited area's smallest x, or 0 if there is no edited area.
GetEditedMinimumZ()
This action returns the smallest sample number along z in the edited area.
Returns
integer: The edited area's smallest z, or 0 if there is no edited area.
GetHeight(number worldX, number worldZ)
This action returns the height of the sample at or just below a world position. It does not blend between samples.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.
Returns
number: The height in world units, or 0 if there is no region there.
GetHeightFromPixel(integer code)
This action reads a height from 0 to 1 from one pixel of a height map. Red holds the coarse part and green the fine part, like the digits of a number, which gives 65536 different heights. This matches Terrain, and is what ImportHeightMap uses for each pixel.
Parameters
codeinteger: The pixel, as read by PixelMap's GetPixel.
Returns
number: The height, from 0 to just under 1.
GetHighestHeight()
This action returns the highest height in any region. It uses each region's height range, so after heights have been lowered it may be higher than the true highest.
Returns
number: The highest height in world units, or 0 if there are no regions.
GetLowestHeight()
This action returns the lowest height in any region. It uses each region's height range, so after heights have been lowered it may be lower than the true lowest.
Returns
number: The lowest height in world units, or 0 if there are no regions.
GetNeighborEdgeHeight(integer locationX, integer locationZ)
This action returns the average height of the ground along the edges a region location shares with the regions next to it, or 0 if it has no neighbors. It is GetBlockEdgeHeight for a block of one region.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
number: The average edge height, in world units, or 0.
GetNormal(number worldX, number worldZ)
This action returns which way the ground faces at a world position, as a vector one unit long. Flat ground faces straight up, (0, 1, 0). Like Terrain3D, it compares the height here with the height one sample further along x and one sample further along z.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.
Returns
Libraries.Compute.Vector3: A new vector pointing away from the ground, or straight up if there is no region there.
GetRegion(integer locationX, integer locationZ)
This action returns the region at a location.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
Libraries.Game.Graphics.Worlds.TerrainRegion: The region, or undefined if there is none there.
GetRegionAtIndex(integer index)
This action returns one of the regions that have been added, in the order they were added.
Parameters
indexinteger: Which region, from 0 to one less than GetRegionCount.
Returns
Libraries.Game.Graphics.Worlds.TerrainRegion: The region.
GetRegionCount()
This action returns the number of regions that have been added.
Returns
integer: The number of regions.
GetRegionFileName(integer locationX, integer locationZ)
This action returns the name of the image file a region's heights are saved in, such as "region_-1_2.png" for the region at location (-1, 2).
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
text: The file name.
GetRegionLocation(integer sample)
This action returns which region location holds a sample, along one axis. It works the same way along x and z. Samples below 0 belong to regions below 0, so sample -1 is in region -1, not region 0.
Parameters
sampleinteger: A sample's number along one axis.
Returns
integer: The region location along that axis.
GetRegionSize()
This action returns how many samples run along each side of every region.
Returns
integer: The number of samples along each side of a region.
GetSampleHeight(integer x, integer z)
This action returns the height of a sample.
Parameters
xinteger: The sample's number along x.zinteger: The sample's number along z.
Returns
number: The height in world units, or 0 if no region holds the sample.
GetSampleSplat(integer x, integer z)
This action returns the packed splat weights of a sample.
Parameters
xinteger: The sample's number along x.zinteger: The sample's number along z.
Returns
integer: The packed weights, or all red if no region holds the sample.
GetSampleX(number worldX)
This action returns the sample at or just below a world position along x.
Parameters
worldXnumber: A position along the x axis, in world units.
Returns
integer: The sample's number along x.
GetSampleZ(number worldZ)
This action returns the sample at or just below a world position along z.
Parameters
worldZnumber: A position along the z axis, in world units.
Returns
integer: The sample's number along z.
GetSavedHighestHeight(integer locationX, integer locationZ)
This action returns the highest height of a saved region, as recorded when it was last saved.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
number: The highest height, or 0 if the region isn't saved.
GetSavedLowestHeight(integer locationX, integer locationZ)
This action returns the lowest height of a saved region, as recorded when it was last saved.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
number: The lowest height, or 0 if the region isn't saved.
GetSlope(number worldX, number worldZ)
This action returns how steep the ground is at a world position, in degrees from flat. 0 is flat ground and 90 is a wall.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.
Returns
number: The slope in degrees, or 0 if there is no region there.
GetSplatEditedMaximumX()
This action returns the largest sample along x in the splat edited area.
Returns
integer: The largest x, or 0 if there is no splat edited area.
GetSplatEditedMaximumZ()
This action returns the largest sample along z in the splat edited area.
Returns
integer: The largest z, or 0 if there is no splat edited area.
GetSplatEditedMinimumX()
This action returns the smallest sample along x in the splat edited area.
Returns
integer: The smallest x, or 0 if there is no splat edited area.
GetSplatEditedMinimumZ()
This action returns the smallest sample along z in the splat edited area.
Returns
integer: The smallest z, or 0 if there is no splat edited area.
GetSplatFileName(integer locationX, integer locationZ)
This action returns the name of the image file a region's splat weights are saved in, such as "region_-1_2_splat.png" for the region at location (-1, 2).
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
text: The file name.
GetSplatWeight(integer code, integer channel)
This action reads one weight back out of packed splat weights.
Parameters
codeinteger: The packed weights.channelinteger: 0 for red, 1 for green, 2 for blue, 3 for alpha.
Returns
number: The weight, from 0 to 1.
GetSurfaceHeight(number worldX, number worldZ)
This action returns the height of the ground at a world position, between the samples. It follows the same two triangles per grid cell that the terrain's mesh and collision shape use, so the answer is on the ground as it is drawn and as the physics sees it. Each cell runs from one sample to the next along x and z. Its left triangle has the corners at the cell's own sample, the next sample along x, and the next sample along z. Its right triangle has the other three corners. Terrain3D's GetSurfaceHeight blends all four corners instead, which can differ slightly from the drawn triangles. Past the last sample of the world, where a corner has no region, that corner is treated as the same height as the cell's own sample.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.
Returns
number: The height in world units, or 0 if there is no region there.
GetVertexSpacing()
This action returns how far apart the samples are, in world units.
Returns
number: The distance between neighboring samples.
HasEditedArea()
This action returns true if any heights have changed since the edited area was last cleared.
Returns
boolean: True if there is an edited area.
HasHeight(number worldX, number worldZ)
This action returns true if there is a region under a world position.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.
Returns
boolean: True if the ground has a height there.
HasRegion(integer locationX, integer locationZ)
This action returns true if there is a region at a location.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
boolean: True if a region has been added there.
HasRegionAnywhere(integer locationX, integer locationZ)
This action returns true if a region at a location is loaded, or is saved and could be loaded. Where neither is true, there is no ground.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
boolean: True if the region exists.
HasSample(integer x, integer z)
This action returns true if there is a region holding a sample.
Parameters
xinteger: The sample's number along x.zinteger: The sample's number along z.
Returns
boolean: True if the sample has a height.
HasSavedRegion(integer locationX, integer locationZ)
This action returns true if a region at a location has been saved to, or listed in, the folder the terrain was last saved to or loaded from.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
boolean: True if the region is saved.
HasSplatEditedArea()
This action returns true if any splat weights have changed since the splat edited area was last cleared.
Returns
boolean: True if there is a splat edited area.
ImportHeightMap(Libraries.Game.Graphics.PixelMap map, integer startX, integer startZ, number heightScale, number offset)
This action copies the heights from a height map image into the terrain, adding regions wherever they are needed. The image uses the same format as Terrain: each pixel's red and green together hold a height from 0 to 1, with red as the coarse part and green as the fine part. Each height is then multiplied by the height scale, and the offset is added to it, like Terrain3D's import. The image's pixels are read in the same order Terrain reads them, so a height map gives the same ground in both.
Parameters
mapLibraries.Game.Graphics.PixelMap: The height map image.startXinteger: The sample along x where the image's first pixel goes.startZinteger: The sample along z where the image's first pixel goes.heightScalenumber: What each height from 0 to 1 is multiplied by.offsetnumber: What is added to each height after it is scaled.
ImportSplatMap(Libraries.Game.Graphics.PixelMap map, integer startX, integer startZ)
This action copies splat weights from an image into the terrain, adding regions wherever they are needed. Each pixel's red, green, blue and alpha are the weights of the four textures. The pixels are read in the same order as ImportHeightMap, so a splat map the same size as a height map lines up with it.
Parameters
mapLibraries.Game.Graphics.PixelMap: The splat map image.startXinteger: The sample along x where the image's first pixel goes.startZinteger: The sample along z where the image's first pixel goes.
IsInRegionMap(integer locationX, integer locationZ)
This action returns true if a location is inside the grid of regions, from -16 to 15 along each axis.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
boolean: True if the location is inside the grid.
IsInSlope(number worldX, number worldZ, number minimumDegrees, number maximumDegrees)
This action returns true if the ground at a world position is as steep as the smallest angle or steeper, and no steeper than the largest angle. Angles are measured in degrees from flat, so 0 is flat ground and 90 is a wall. This is the same test Terrain3D uses to keep painting or placing things to slopes within a range.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.minimumDegreesnumber: The smallest slope allowed, from 0 to 90.maximumDegreesnumber: The largest slope allowed, from 0 to 90.
Returns
boolean: True if the slope is in the range, or false if there is no region there.
Load(Libraries.System.File folder)
This action loads a whole terrain saved by Save. The terrain must not have any regions yet. The whole loaded terrain becomes the edited area. Loading uses PixelMap, so it needs a running game.
Parameters
folderLibraries.System.File: The folder the terrain was saved into.
LoadRegion(Libraries.System.File folder, integer locationX, integer locationZ)
This action loads one saved region from a folder and adds it to the terrain. Unlike AddRegion, it does not add to the edited area, since the region is being brought back rather than changed. The settings must have been read first, with LoadSettings or Load. Loading uses PixelMap, so it needs a running game.
Parameters
folderLibraries.System.File: The folder the terrain was saved into.locationXinteger: The region location along x.locationZinteger: The region location along z.
Returns
Libraries.Game.Graphics.Worlds.TerrainRegion: The loaded region.
LoadSettings(Libraries.System.File folder)
This action reads "terrain.json" from a folder: the region size, the vertex spacing, and which regions are saved there, with their height ranges. No regions are loaded, so a game can load just the ones it needs with LoadRegion. The terrain must not have any regions yet. The file is read with the standard library's JavaScriptObjectNotation. It looks like this: { "format": "TerrainData", "version": 2, "regionSize": 64, "vertexSpacing": 0.5, "regions": [ {"x": -1, "z": 2, "lowest": -3.25, "highest": 7.5} ] }
Parameters
folderLibraries.System.File: The folder the terrain was saved into.
PackSplat(number red, number green, number blue, number alpha)
This action packs four splat weights into one number, the way a PixelMap pixel holds red, green, blue and alpha. Each weight is from 0 to 1 and says how much of one ground texture to show; they are usually made to add up to 1. Weights outside 0 to 1 are limited to it.
Parameters
rednumber: The weight of the first texture.greennumber: The weight of the second texture.bluenumber: The weight of the third texture.alphanumber: The weight of the fourth texture.
Returns
integer: The packed weights.
PaintSplat(number worldX, number worldZ, number radius, integer channel, number strength)
This action paints one texture onto the ground in a circle around a world position. Each sample's weights move toward showing only that texture, by the strength at the center, fading smoothly to nothing at the edge of the circle. A strength of 1 paints the center completely. Samples with no region are left alone.
Parameters
worldXnumber: The circle's center along x, in world units.worldZnumber: The circle's center along z, in world units.radiusnumber: The circle's radius, in world units.channelinteger: The texture to paint: 0 red, 1 green, 2 blue, 3 alpha.strengthnumber: How far to move toward that texture at the center, from 0 to 1.
RaiseArea(number worldX, number worldZ, number radius, number amount)
This action changes the heights in a circle around a world position. The center changes by the full amount, and the change fades smoothly to nothing at the edge of the circle. A negative amount lowers the ground. Samples with no region are left alone. This is a simple tool for trying out editing; brushes like Terrain3D's will replace it.
Parameters
worldXnumber: The circle's center along x, in world units.worldZnumber: The circle's center along z, in world units.radiusnumber: The circle's radius, in world units.amountnumber: How much to raise the center, in world units.
RayCast(Libraries.Compute.Vector3 origin, Libraries.Compute.Vector3 direction, number maximumDistance)
This action finds where a ray first meets the ground, for picking a point on the terrain with the mouse. It walks along the ray half a sample at a time, only over the part of the ray between the terrain's lowest and highest heights, and once it passes from above the ground to below it, it narrows down the crossing. The ground is the same surface GetSurfaceHeight gives, made of the same triangles as the mesh. Places with no region are skipped, so the ray can pass over a gap and hit ground beyond it. It needs no physics or collision. A ray that starts below the ground only finds a place where it comes up through the ground and goes back down.
Parameters
originLibraries.Compute.Vector3: Where the ray starts, in world units.directionLibraries.Compute.Vector3: The direction of the ray. It need not be of length 1.maximumDistancenumber: How far along the ray to look, in world units.
Returns
Libraries.Compute.Vector3: The point where the ray meets the ground, or undefined if it doesn't within the distance.
RemoveRegion(integer locationX, integer locationZ)
This action removes the region at a location, if there is one. The space it covered is added to the edited area.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.
RemoveSplatLayer(integer layer)
This action takes a ground layer out of every sample's splat weights, for when a terrain material loses a layer: the layer's weight goes to the first layer, and the layers after it move down one channel, so their painting stays on the same textures. Every region becomes part of the splat edited area.
Parameters
layerinteger: The layer to take out, from 0 to 3. Taking out layer 0 gives its weight to the new first layer.
RestoreRegion(integer locationX, integer locationZ, Libraries.Game.Graphics.Worlds.TerrainRegion copy)
This action puts a region location back the way a copy says it was, for undo and redo. If the copy is undefined, there was no region there, so any region there now is removed. Otherwise the region there is made the same as the copy, and one is added first if there isn't one. Either way, the whole region is added to the edited area and the splat edited area, and the region is marked as modified, since it no longer matches what was saved.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.copyLibraries.Game.Graphics.Worlds.TerrainRegion: A copy of the region from TerrainRegion's Copy, or undefined for no region.
Save(Libraries.System.File folder)
This action saves the whole terrain to a folder, which is made if it does not exist. Like Terrain3D, each region's heights are saved to their own image, named for its location, such as "region_-1_2.png". A region whose splat weights have been painted also saves them, as "region_-1_2_splat.png"; an unpainted region doesn't, since loading gives it the default weights. A JSON file named "terrain.json" holds the region size, the vertex spacing, and for every saved region its location and the height range its image covers. Every region is marked as unmodified afterward. Regions that were saved to the same folder earlier, and have been unloaded since, stay listed in "terrain.json". Saving uses PixelMap, so it needs a running game.
Parameters
folderLibraries.System.File: The folder to save into.
SaveRegion(Libraries.System.File folder, Libraries.Game.Graphics.Worlds.TerrainRegion region)
This action saves one region's image to a folder, which is made if it does not exist, updates "terrain.json" to match, and marks the region as unmodified. Saving uses PixelMap, so it needs a running game.
Parameters
folderLibraries.System.File: The folder to save into.regionLibraries.Game.Graphics.Worlds.TerrainRegion: The region to save.
SaveSettings(Libraries.System.File folder)
This action writes "terrain.json" to a folder: the region size, the vertex spacing, and the location and height range of every region whose image has been saved to this folder. See LoadSettings for what it looks like.
Parameters
folderLibraries.System.File: The folder to save into.
SetHeight(number worldX, number worldZ, number height)
This action sets the height of the sample at or just below a world position. If there is no region there, nothing changes.
Parameters
worldXnumber: A position along the x axis, in world units.worldZnumber: A position along the z axis, in world units.heightnumber: The new height, in world units.
SetRegionSize(integer size)
This action sets how many samples run along each side of every region. It can only be changed while there are no regions. The size must be 64, 128, 256, 512, 1024 or 2048, the sizes Terrain3D allows. The default is 256.
Parameters
sizeinteger: The number of samples along each side of a region.
SetSampleHeight(integer x, integer z, number height)
This action sets the height of a sample, and adds the sample to the edited area. If no region holds the sample, nothing changes.
Parameters
xinteger: The sample's number along x.zinteger: The sample's number along z.heightnumber: The new height, in world units.
SetSampleSplat(integer x, integer z, integer code)
This action sets the packed splat weights of a sample, and adds it to the splat edited area. If no region holds the sample, nothing changes.
Parameters
xinteger: The sample's number along x.zinteger: The sample's number along z.codeinteger: The packed weights, as made by PackSplat.
SetVertexSpacing(number spacing)
This action sets how far apart the samples are, in world units, along x and z. The default is 1. A larger spacing spreads the same samples over more ground.
Parameters
spacingnumber: The distance between neighboring samples. It must be more than 0.
UnloadRegion(integer locationX, integer locationZ)
This action takes a region out of the terrain without saving it, and without adding to the edited area. Save it first with SaveRegion if it has been modified.
Parameters
locationXinteger: The region location along x.locationZinteger: The region location along z.