# Angle [Solved]

How to test angle between two objects? Do I have to have another object at the same position as one of the objects and let it point toward the second object to see the angle? Also I don’t want the object to point towards each other.

Aha got it!
Heres my solution:
First do PointX2-PointX1 and save it in a variable. Then do PointY2-PointY1. This gives you a triangle (This is used for calculating slope too.). Now do ToDeg(atan(Variable(X)/Variable(Y))). Save that to a variable and you got the angle between 2 points! Note that in Game Develop, angles are reversed vertically : so 90 degrees for this equation would be 270 degrees, but 180 degrees would still be 180 degrees.

The formula is:

``atan2(deltaY, deltaX)  or  atan(deltaY/deltaX)``

But the atan2 is better, it takes account the vertical angle (another way if deltaX = 0: deltaY/0 and you’ll get an error) and take account the division sign from quadrants (division between two negative quadrants gives a possitive value… as the division between the positive quadrants) Sorry, I know that atan2 is better, I just did not see it .