Git Product home page Git Product logo

Comments (6)

lucap86 avatar lucap86 commented on June 2, 2024 2

this is the fix that i've found:

in update function
this.game.iso.unproject({ x: (this.game.input.activePointer.position.x + this.game.camera.x) / this.game.camera.scale.x, y: (this.game.input.activePointer.position.y + this.game.camera.y) / this.game.camera.scale.y }, this.game.cursorPos);

unproject function

var x = point.x - (this.game.world.x + this.game.camera.x) - (this.game.world.width * this.anchor.x);

var y = point.y - (this.game.world.y + this.game.camera.y) - (this.game.world.height * this.anchor.y) + z

another aproach may be put all into unproject function

var x = ((point.x + this.game.camera.x) / this.game.camera.scale.x) - (this.game.world.x + this.game.camera.x) - (this.game.world.width * this.anchor.x);
var y = ((point.y + this.game.camera.y) / this.game.camera.scale.y) - (this.game.world.y + this.game.camera.y) - (this.game.world.height * this.anchor.y) + z;

from phaser-plugin-isometric.

YuriBrunetto avatar YuriBrunetto commented on June 2, 2024 1

@lucap86 that worked for me! thank you <3

from phaser-plugin-isometric.

lucap86 avatar lucap86 commented on June 2, 2024

ok i've found a solution, in the game update

game.iso.unproject({
x: game.input.activePointer.position.x / game.camera.scale.x,
y: game.input.activePointer.position.y / game.camera.scale.y
}, game.cursorPos);

do you think that unproject should support camera scale?

from phaser-plugin-isometric.

lucap86 avatar lucap86 commented on June 2, 2024

Same thing happen when change camera x/y.

from phaser-plugin-isometric.

wassname avatar wassname commented on June 2, 2024

Nice work! Making un/projection handle world scaling sounds like a great step forward, maybe make it a pull request?

from phaser-plugin-isometric.

lewster32 avatar lewster32 commented on June 2, 2024

It's an interesting case - project and unproject are meant to be low-level functions for performing basic isometric math on ambiguous coordinates; it doesn't and shouldn't care about scale, offset or anything else. I personally think that although this is a useful addition, it probably shouldn't be added to unproject but could be added elsewhere. Not entirely sure where though...

from phaser-plugin-isometric.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.