Should fix the Error in rotation

This commit is contained in:
Sandeep Nambiar 2014-08-13 05:19:21 +05:30
parent 9977d5e204
commit daade10ecc

View file

@ -823,7 +823,9 @@ Phaser.Point.rotate = function (a, x, y, angle, asDegrees, distance) {
distance = Math.sqrt(((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y))); distance = Math.sqrt(((x - a.x) * (x - a.x)) + ((y - a.y) * (y - a.y)));
} }
return a.setTo(x + distance * Math.cos(angle), y + distance * Math.sin(angle)); var requiredAngle = angle - Math.atan2(a.y - y, a.x - x);
return a.setTo(x + distance * Math.cos(requiredAngle), y + distance * Math.sin(requiredAngle));
}; };