Created
August 28, 2014 10:46
-
-
Save mflux/c28ceb685d707f82c09d to your computer and use it in GitHub Desktop.
Phaser Isometric Unprojector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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