Collapse Sidebar



Not to be confused with datatype/Region3, a separate class that fulfills a different purpose.

Region3int16 is a data type which describes a volume in 3D space similar to an axis-aligned rectangular prism. It uses two datatype/Vector3int16 to store the volume’s bounds in the Min and Max properties. It is constructed using Region3int16.new(Min, Max), given the two Vector3int16 bounds. This data type features no functions or operations.

Calculating Center and Size

This data type differs from datatype/Region3 in that it stores its bounds directly, rather than through a center and size combination. Nonetheless, it is possible to calculate these dimensions using Min and Max:

local region = Region3int16.new(Vector3int16.new(0, 0, -3), Vector3int16.new(4, 4, 4))
local size = region.Max - region.Min
local center = (region.Max + region.Min) / 2

Conversion to Region3

The following function can be used to convert a Region3int16 into a similar Region3. It does this by converting the Min and Max properties, which are Vector3int16, into datatype/Vector3 used with Region3.new.

local function Region3int16toRegion3(region16)
	return Region3.new(
		Vector3.new(region16.Min.X, region16.Min.Y, region16.Min.Z),
		Vector3.new(region16.Max.X, region16.Max.Y, region16.Max.Z)

See also

  • datatype/Region3, a similar data type
  • /articles/Scripting With Terrain, an article describing how to generate terrain of different sizes and shapes using voxel-based code


Region3int16.new ( Vector3int16 min, Vector3int16 max )

Creates a new Region3int16 given its bounds as datatype/Vector3int16.


Vector3int16 Region3int16.Min

The lower bound of the Region3int16, as passed to Region3int16.new.

Vector3int16 Region3int16.Max

The upper bound of the Region3int16, as passed to Region3int16.new.