Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I use trigonometry in roblox studio like math.cos?

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.

1 answer

✓ Accepted answer

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)

2 comments

0

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

0

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.