I don't understand how they work in circles. Also How can i apply trignometry to scripting...
http://wiki.roblox.com/index.php?title=Terrain_Generation
I also have no idea how this works... May someone please explain how each line works. especially the math parts ...
for i = 1,40 do
y=100*math.sin(i)
p = Instance.new("Part") p.CFrame = CFrame.new(Vector3.new(100*i, y+100, 0)) p.Size = Vector3.new(8,8,8) p.Anchored = true p.BottomSurface = "Smooth" p.TopSurface = "Smooth" p.Parent = game.Workspace p.BrickColor = BrickColor.new(26)
end
This question already addresses basic trigonometry. You can find many more resources with Google (both on ScriptingHelpers and off).
If you plot y = sin(x) you get a shape called a sine wave.
It's smooth, and it's bumpy. This makes it very useful for making natural looking motion, such as swaying (taking math.sin(time)
) or hills (taking math.sin(x)
or math.sin(z)
).
You can add more sine waves of different sizes / frequencies together to get more complicated but still smooth waves.