local cos = math.cos(28)
print(cos)
I just learnt trigonometry in class and wanted to do math in roblox studio. I read some articles about math.cos but I cant seem to get it to work.
local cos = math.cos(28)
print(cos)
I just learnt trigonometry in class and wanted to do math in roblox studio. I read some articles about math.cos but I cant seem to get it to work.
Okay, so you've started trigonometry and that's great the problem is you probably only know about degree angles; that 360 degrees is one circle. But in Roblox, or pretty much any higher-level calculations we use a different angle measurement called radians; that 2pi (the 3.142 one) is equals to one circle.
Simply either use the radian equivalent of 28 degrees (which is just 2pi multiplied by [degrees] divided by 360) or simply use the math.rad(degrees) and math.cos that.
So in short, you're using degrees not radians.
local InRadians = math.rad(28)
local cos = math.cos(InRadians)
print(cos)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
if you have time could u explain what does this mean? "use the radian equivalent of 28 degrees (which is just 2pi multiplied by [degrees] divided by 360)" sorry i dont get what you mean by that
Multiply the degrees you want to convert to radians by 2 and again multiply it by pi. Then divide the result by 360. You can also just do math.rad(angle in degrees) to get the angle in radians.