Using Math to generate Cylinders?

It’s the same math as generating a circle except you increment the Y position. If it makes sense, cylinders are basically infinitely stacked circles. Just like how a sphere is infinitely many circles, but instead they’re different sizes.

local Radius = 1
local Circle = math.pi * 2
local Amt = 10000
local Height = 10

for Y = 0, Height do
	for Number = 1, Amt do
		local Angle = Circle / Amt * Number
		local X = math.sin(Angle) * Radius
		local Z = math.cos(Angle) * Radius

		local Position = Vector3.new(X, Y, Z)
	end
end

If you’re confusing on what I meant by “infinitely many stacked circles” try reading these. You don’t really need to understand the math, but they explain the concept with nice graphics:

https://math.libretexts.org/Bookshelves/Calculus/Book%3A_Active_Calculus_(Boelkins_et_al)/6%3A_Using_Definite_Integrals/6.2%3A_Using_Definite_Integrals_to_Find_Volume
https://www.mathalino.com/reviewer/derivation-formulas/derivation-formula-volume-sphere-integration

2 Likes