Skip to content

Commit

Permalink
Merge pull request phaserjs#218 from TheJare/dev
Browse files Browse the repository at this point in the history
Fix normalizeAngle and wrapAngle (again?)
  • Loading branch information
photonstorm committed Nov 24, 2013
2 parents d30e297 + 8015194 commit cbd9b77
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions src/math/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ Phaser.Math = {
if (typeof radians === "undefined") { radians = true; }

var rd = (radians) ? Math.PI : 180;
return this.wrap(angle, rd, -rd);
return this.wrap(angle, -rd, rd);

},

Expand Down Expand Up @@ -656,23 +656,7 @@ Phaser.Math = {
*/
wrapAngle: function (angle) {

var result = angle;

// Nothing needs to change
if (angle >= -180 && angle <= 180)
{
return angle;
}

// Else normalise it to -180, 180
result = (angle + 180) % 360;

if (result < 0)
{
result += 360;
}

return result - 180;
return this.wrap(angle, -180, 180);

},

Expand Down

0 comments on commit cbd9b77

Please sign in to comment.