Skip to content

Commit daade10

Browse files
committed
Should fix the Error in rotation
1 parent 9977d5e commit daade10

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/geom/Point.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,9 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) {
823823
distance = Math.sqrt(((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y)));
824824
}
825825

826-
return a.setTo(x + distance * Math.cos(angle), y + distance * Math.sin(angle));
826+
var requiredAngle = angle - Math.atan2(a.y - y, a.x - x);
827+
828+
return a.setTo(x + distance * Math.cos(requiredAngle), y + distance * Math.sin(requiredAngle));
827829

828830
};
829831

0 commit comments

Comments
 (0)