[Nevermind]What's the formula behind the angle()?

Discussion and feedback on Construct 2

Post » Sat Nov 12, 2016 2:10 pm

Does anyone know the formula that's going on behind this function: angle(x1, y1 , x2, y2) ?

I tried using the (Distance formula to get the hypotenuse) ....
I also used the trigonometric formulas SOHCAHTOA to get each sides and angles...
I also used cos(a/h) * 180/pi to get the angle but it seems wrong.

I also used this formula cos = { u1*v1 + u2*v2 / (sqrt[u1^2+v2^2])(sqrt[v1^2+v2^2]) }

but no luck...


Anything i'm missing...?

Thanks.

Update: Edit:

:lol: Lol. My formula was correct from the beginning, i just forgot to add + 90 degrees since i was using a tiledbackground.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
65
S
21
G
90
Posts: 1,124
Reputation: 59,857

Post » Sat Nov 12, 2016 4:01 pm

It's just atan, but most programming languages provide an atan2 variant that calculates the correct quadrant.
Scirra Founder
B
398
S
236
G
88
Posts: 24,428
Reputation: 194,625


Return to Construct 2 General

Who is online

Users browsing this forum: MadSpy, Yahoo [Bot] and 16 guests