kontra
kontra copied to clipboard
angleToTarget returns incorrect angle
I seem to have gotten my trig wrong and thought the way to calculate x,y from an angle was:
x = Math.sin(angle)
y = -Math.cos(angle)
When in reality it should be reversed.
x = Math.cos(angle)
y = -Math.sin(angle)
This made me incorrectly add a quarter rotation to angleToTarget
to get the movement correct. I need to remove the quarter rotation, and then the angle will be correct.
This also affects other helper functions like movePoint
so need to do a one over on the code to make sure I find everything this affects.