position to angle code example
Example: angle from position
var deltaX = x2 - x1;
var deltaY = y2 - y1;
var rad = Math.atan2(deltaY, deltaX); // In radians
var deg = rad * (180 / Math.PI);
var deltaX = x2 - x1;
var deltaY = y2 - y1;
var rad = Math.atan2(deltaY, deltaX); // In radians
var deg = rad * (180 / Math.PI);