Comments (6)
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.
@lucap86 that worked for me! thank you <3
from phaser-plugin-isometric.
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.
Same thing happen when change camera x/y.
from phaser-plugin-isometric.
Nice work! Making un/projection handle world scaling sounds like a great step forward, maybe make it a pull request?
from phaser-plugin-isometric.
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)
- how to draw staggered tilemaps? HOT 9
- Cannot read property '4' of undefined HOT 1
- License HOT 2
- Does this plugin support isometric tilemaps? HOT 2
- Static bodies HOT 4
- Jumping doesn't work when holding LEFT + UP HOT 3
- Update npm version to latest HOT 1
- Types (possibly) diverged from Phaser? HOT 2
- Objects that are not cubes HOT 1
- isometric wall HOT 2
- isoSprite _isoPositionChanged is broken HOT 2
- TypeScript: Possibly wrong typing of IsoSprite.isoBounds
- typings may be off
- sprite.anchor broken HOT 2
- isoArcade.setBounds does not update octree HOT 2
- Tile Rotation (Flipping axis) HOT 6
- The scale problems in isobounds tile
- Porting to Phaser 3 HOT 3
- Outdated type definitions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phaser-plugin-isometric.