Edit:
-- Changed my sin function to
for i = equation[2], equation[3], 0.5 do
spawn(function()
local new_node = Instance.new("Part")
new_node.Size = Vector3.new(1,1,1)
new_node.Anchored = true
local x = (i)
local y = math.sin(i * math.pi/180) * equation[4]
new_node.Position = Vector3.new(x, y, 0)
new_node.Parent = equation_graph
end)
end
I was trying to map out/graph a sin wave with Roblox by using parts as a representation. Linear and quadratic sequences all worked out fine. However, I got an interesting result of sin from this.
The script I used to generate this would be:
for i = equation[2], equation[3], 0.1 do
spawn(function()
local new_node = Instance.new("Part")
new_node.Size = Vector3.new(1,1,1)
new_node.Anchored = true
local x = (i)
local y = (math.sin(math.deg(i))) * equation[4]
print(x, y)
new_node.Position = Vector3.new(x, y, 0)
new_node.Parent = equation_graph
end)
end
I’ve tried inspecting each of the part’s to see what’s going on with them but I couldn’t conclude anything from it. Anyone else got some suggestions?