Why isn't air being changed to the specified material?


#1

Hey there, I have a plugin I recently made called Terrain Converter. I am trying to add a grow tool option, however, I am unable to override air voxels?

Here is my code:

			elseif mode == 'grow' then
				if materials[x][y][z] == materialsDictionary[mat1.Value] or materials[x][y][z] == Enum.Material.Air then
					materials[x][y][z] = materialsDictionary[mat2.Value]
				end 
			end

This doesn’t override air voxels even though I am allowing it too. Is there something special I have to do for air voxels?


#2

You will also need to set voxel occupancy. You are currently only setting material, not how much of the voxel is occupied by that material.

See read/writeVoxels
https://developer.roblox.com/articles/Scripting-With-Terrain


#3

Thank you!