I know the function workspace.Terrain:FillBall(Position, Radius, Enum.Material.Air)
shall delete all the terrain in the Radius sized ball at Position, but, how can I return an array containing the number of cells of each material (if any) were displaced? Basically what I want is ReadVoxels() but accepts a point + radius instead of a region3.
function ClearTerrain(Position) workspace.Terrain:FillBall(Position, 8, Enum.Material.Air) --Return a table in this format {{Enum.Material.Rock, 8}, {Enum.Material.Basalt, 10}} for example, to know how many cells of each material were replaced with air. end
This example would be the case if 8 rock and 10 basalt cells were destroyed.
Just to clarify: This question is on-topic as it is to develop my Roblox game.
The problem with workspace.Terrain:ReadVoxels()
is that it returns results that the rest of my program cannot parse, and it checks for cells in a block shape rather than a ball. The approach I MIGHT want to take is readvoxels once, clear out the area, read the same voxels again, and subtract, to disregard the cells that stay the same. Then parse the results into the format stated in the code block above. Though this might lack efficiency, and I don't quite know how to parse the results.