Goal: I’m making a tower that consists of parts, and I want to figure out an equation that will always get the perfect amount of parts to build my tower.
First off, there are variables towards these towers:
The variable wavelength is greatly shown in the image below, although explaining it here will make it more sensible. So basically if a tower had a wavelength of 1, the parts would go around the tower one time.
Left Tower:THIS is what I want to achieve. Having the correct amount of parts to make the tower look smooth
Middle Tower: This tower has a part size of 1, height of 20, wavelength of 1, and size of 20, and maxParts of 50
Right Tower: This tower has a size of 20, maxParts of 50, part size of 1, height of 20, and wavelength of 2 (Notice how the parts of this tower goes around twice) .
The length of your (helix) line = sqrt(h^2 + c^2) where h is the height increase over one full revolution and c is the flat circumference (2 pi r). You need to adjust your radius by half the part width if you want the outer faces to be smooth. Once you know the length of the helix line for one rev, multiply by your wavelength value for the length of the whole thing, then divide by your part size for a part count.
Hey this works thanks! I only encountered one problem, in which you had to divide the product of lengthOfHelix * waveLength by (partSize / 2)
local partSize = 10 -- size of each part
local height = 500 -- The height of the tower
local waveLength = 10 -- basically the amount of rings the parts create
local size = 300 -- the size of the circle
-- // Fixed Values
local radius = size / 2
local heightOfOneRevolution = (height / waveLength)
local lengthOfHelix = math.sqrt((heightOfOneRevolution)^2 + (2*math.pi * radius)^2)
lengthOfHelix -= (partSize/2)
--\\
local maxParts = (lengthOfHelix * waveLength) / (partSize/2)