ox# = object position x(1)
oy# = object position y(1)
oz# = object position z(1)
ax# = ox# - object position x(2)
ay# = oy# - object position y(2)
az# = oz# - object position z(2)
hdist# = sqrt(ax#*ax#+az#*az#)
ang# = atanfull(hdist#, ay#)
Imagine a triangle with one side in the horizontal (X/Z) plane going from one object to directly above or below the other. The next side goes to the object, so either up or down to it (the difference in height). The hypotenuse then joins the two objects.
You want to find the angle between the hypotenuse and the first side given the lengths of the first and second side.
The length of the first side is sqrt(ax#*ax#+az#*az#) (pythagoras for X and Z distance)
The second side is ay# (difference in height)
The angle is then the arc-tangent of those two divided, or for simplicity atanfull().
[b]
