I\'m creating a simple 2D game in javascript/canvas. I need to figure out the angle of a certain object relative to my position.
So: say I\'m at (10,10) and the object i
In HTML5 canvas the origin is the top left corner hence the y axis grows from top to bottom. So regardless of wherever you are on the unit circle to calculate the angle of point A to the center(C) you should in fact do like
angle = Math.atan2(Cy-Ay,Ax-Cx)
and you will get your result in the range of [-π, π].
I have no idea why they haven't made the canvas origin the bottom left corner.