Voxelizer module made 4 fun :p

I saw a post a week or maybe more ago about someone making a Voxelizer which just breaks parts into pieces.

Heres how to use!
Copy this script

local Voxelizer = {}

function Voxelizer.Voxelize(Part,XDivs,YDivs,ZDivs)
	local function MakePart(Position,Size)
		local Voxel = Instance.new("Part",script)
		Voxel.Size = Size
		Voxel.Position = Position
		Voxel.Anchored = true
		Voxel.CanCollide = false
		Voxel.Material = Part.Material
		Voxel.TopSurface = Enum.SurfaceType.Smooth
		Voxel.BottomSurface = Enum.SurfaceType.Smooth
		return Voxel
	end
	local Size = Part.Size
	local SizeX,SizeY,SizeZ = Size.X/XDivs,Size.Y/YDivs,Size.Z/ZDivs
	local TopRightFront = Part.CFrame*CFrame.new(Size.X/2,Size.Y/2,-Size.Z/2)
	local BottomLeftBack = TopRightFront:Inverse()
	local Off = CFrame.new(-SizeX/2,-SizeY/2,SizeZ/2).Position
	for x = 0, XDivs-1 do
		for y = 0, YDivs-1 do
			for z = 0, ZDivs-1 do
				local Color = Color3.new(x/XDivs,y/YDivs,z/ZDivs)
				local Pos = Off+TopRightFront.Position+Vector3.new(-x*SizeX,-y*SizeY,z*SizeZ)
				MakePart(Pos,Vector3.new(SizeX,SizeY,SizeZ)).Color = Color
			end
		end
	end
end

return Voxelizer

Place it in a module script parented to a normal script
Inside the normal script paste this

local Voxelizer = require(script.Voxelizer) -- Part to module.

Voxelizer.Voxelize(workspace.Part,5,1,5) -- 1st argument = Part, 2nd-4th arguements = Number of divisions on X, Y, Z axis respectively.

Here are a few images
image
image
image

idk give sum feedback.
  • Nice.
  • Good.
  • Bad.

0 voters

If this gets positive replies I swear ill commit banana :banana:

6 Likes

This is pretty neat, you should try to pull this off with wedges and other shapes.

If only I had this resource available a couple of months back!

Idk how doe. I can do with circles ig but wedges… tough luck and yea tough luck with circles and cylinders too…
But thanks

And thank you all for giv8ng positive comments while this should get negative comments cuz it took me 10 minutes. And things that take me days get so many negative comments that make me sad. :frowning: