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

Discussion and feedback on Construct 2

### » 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. 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
75
S
25
G
92
Posts: 1,148
Reputation: 61,618

### » 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
408
S
242
G
92
Posts: 24,910
Reputation: 198,648