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

How do I solve for this angle Triganometry?

https://imgur.com/w7vMsyH

I am trying to figure out the angle from 0 Degrees to the Triangle's Hypotenuse. Both X and Y are input values to this function and can be positive or negative values. I need the solution in a mathematical function so I can input X and Y to get the angle.

Thanks!

4 comments

0

The image for me doesn't work, but you just need a simple trigonometry equation, which is inverse of tangent(Y/X). This should give you the answer, but I am not too sure how you would write inverse of tangent in Lua. Hope this helps!

0

inverse of tangent is arctangent, in LUA its named as atan

1

yeah, i just read some more on it. I suggest you use atan2 instead of atan. Here is why: https://scriptinghelpers.org/questions/18670/may-someone-explain-mathatan2-and-its-capabilities

0

Somewhat useless comment. Trigonometry not "Triganometry." (Just a heads up xdd)

1 answer

Cant see your image, but basically just do this, im assuming your X and Y is the hypotenuse and the adjacent length, then multiply it by 180/pi

local angle = math.acos(Y/X)*(180/math.pi)

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