Skip to content

Instantly share code, notes, and snippets.

@mflux
Created August 28, 2014 10:46
Show Gist options
  • Save mflux/c28ceb685d707f82c09d to your computer and use it in GitHub Desktop.
Save mflux/c28ceb685d707f82c09d to your computer and use it in GitHub Desktop.
Phaser Isometric Unprojector
Phaser.Plugin.Isometric.Projector.prototype.unproject = function (point, out) {
if (typeof out === "undefined") {
out = new Phaser.Plugin.Isometric.Point3();
}
var px = point.x;
var py = point.y;
px *= this.projectionRatio;
px -= this.game.world.width * this.anchor.x / 2;
py -= this.game.world.height * this.anchor.y;
out.x += px + py;
out.y -= ( px - py );
return out;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment