Region3 is a data type that describes a volume in 3D space similar to an axis-aligned rectangular prism. It is commonly used with
Terrain functions and functions that detect parts within a volume, such as
- The prism’s center can be accessed using the
- The prism’s size is available in the
datatype/Vector3Size property. Note that the components of this property may be negative!
When converted to a
articles/String|string, the output format is
CFrame; Size where each of these is the respective property also converted to a string.
The only operation that can be done on a
Region3.ExpandToGrid(resolution), which returns a new
Region3 whose bounds comply with a provided resolution value. The resulting volume may be equal to or greater than the original volume, but never smaller.
datatype/Region3int16, a similar data type
/articles/Scripting With Terrain, an article describing how to generate terrain of different sizes and shapes using voxel-based code
|Region3.new ( Vector3 min, Vector3 max )|
Creates a new Region3 given the
Note that the order of the provided bounds matters: by switching them, the polarity of the Size components will switch. It is possible to create a Region3 with a negative volume.
This code sample constructs a Region3 using two Vector3s describing its bounds. It then prints information about the Region3.
The center location and rotation of the Region3
The 3D size of the Region3
|Region3 Region3:ExpandToGrid ( int Region )|
A function that expands the Region3 so that it is aligned with a voxel grid based on the provided resolution and returns the expanded Region3.
All you need to do is perform the method on the Region3 you have defined, providing a resolution. Then, the function will align the region so that it is compatible with the
Expanding a Region3 to a Grid
This code sample creates a