mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 05:03:37 +00:00
Should fix the Error in rotation
This commit is contained in:
parent
9977d5e204
commit
daade10ecc
1 changed files with 3 additions and 1 deletions
|
@ -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));
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue