Created
December 4, 2020 20:04
-
-
Save SigmaThetaTech/a45e57e63cf3af87f74371f548960cc9 to your computer and use it in GitHub Desktop.
Creates a conical spiral in Roblox!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
local CONE_HEIGHT = 10 | |
local CONE_ANGLE = 30 | |
local FREQUENCY = 10 | |
local theta = math.rad(CONE_ANGLE) | |
function f(z) | |
z = -z | |
local newPosition = Vector3.new( | |
math.tan(theta) * z * math.cos(FREQUENCY * z), | |
math.tan(theta) * z * math.sin(FREQUENCY * z), | |
z | |
) | |
return newPosition | |
end | |
for i = 0, CONE_HEIGHT, 0.01 do | |
local newBrick = Instance.new("Part") | |
newBrick.Size = Vector3.new(0.1, 0.1, 0.1) | |
newBrick.Anchored = true | |
newBrick.BrickColor = BrickColor.Red() | |
newBrick.Position = f(i) | |
newBrick.Parent = game.Workspace | |
wait() | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment