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 Sin Cos and Tan?

I know in math class that Sin is Opp over Hyp, Cos is Opp over Adj, and Tan is Adj over hyp, but How do I use that in Roblox?

Lets say I have Brick A. Brick A is facing 20 degrees. Brick B is 10 studs away (hypotenuse) from Brick A, and its in line to where brick A is facing.

How can I use Sin / Cos / Tan in roblox to find measurements only having information of the Angle of Brick A and the Hypotenuse?

Thanks!

1 comment

0

What "measurements" are you trying to obtain? What is the specific problem that you have that you need solved?

1 answer

✓ Accepted answer

This is quite a complicated concept in Roblox, however it is quite simple. At first I thought you have to come up/research the actual formula (which I'm sure would take hours) on sin, cos and tan. However Lua has already added trigonometry in scripting.

Trigonometry is purely based upon 3 special functions:

math.sin()
math.cos()
math.tan()

Yep it's that simple :D

Consider those 3 functions as the same key you see in a scientific calculator.

For further detail, you can go to this site: http://wiki.roblox.com/index.php?title=Trigonometry as it also provides you an example on how to use it

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