Skip to content

Instantly share code, notes, and snippets.

@lextoumbourou
Last active May 11, 2021 11:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lextoumbourou/b1b29c27b69caf29cc2f9a2e04949734 to your computer and use it in GitHub Desktop.
Save lextoumbourou/b1b29c27b69caf29cc2f9a2e04949734 to your computer and use it in GitHub Desktop.
Create a single Voxel of Terrain in Roblox
local Terrain = game:GetService("Workspace").Terrain
-- The resolution required for Terrain system.
local terrainResolution = 4
-- The smallest possible voxel size.
local region = Region3.new(Vector3.new(0,0,0), Vector3.new(4,4,4))
-- The material as a 1x1x1 3d-grid. What material should go in the voxel?
local material = {
{
{Enum.Material.Water}
}
}
-- The occupancy values of the voxel grid. How full should each voxel be?
local occupancy = {
{
{1}
}
}
Terrain:WriteVoxels(region, terrainResolution, material, occupancy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment