Open FantomHD opened 7 years ago
Update: I've found the source of the issue. sprite.anchor.setTo(x, y) is actually sprite.anchor.setTo(x, z) for some reason. When i do sprite.anchor.y = .7 it modifies the sprites z rather than y.
Update: It's been fixed, but ill keep the issue open, maybe you should update the plugin with the fix as this is a pretty big part part of phaser.
I changed lines 2467-2468 in the plugin source.
I changed:
this.position.x = this.sprite.isoX + ((this.widthX * -this.sprite.anchor.x) + this.widthX * 0.5) + this.offset.x;
this.position.y = this.sprite.isoY + ((this.widthY * this.sprite.anchor.x) - this.widthY * 0.5) + this.offset.y;
this.position.z = this.sprite.isoZ - (Math.abs(this.sprite.height)*(1-this.sprite.anchor.y)) + (Math.abs(this.sprite.width * 0.5)) + this.offset.z;
to
this.position.x = this.sprite.isoX + ((this.widthX * -this.sprite.anchor.x) + this.widthX * 0.5) + this.offset.x;
this.position.y = this.sprite.isoY + ((this.widthY * this.sprite.anchor.y) - this.widthY * 0.5) + this.offset.y;
this.position.z = this.sprite.isoZ - (Math.abs(this.sprite.height)) + (Math.abs(this.sprite.width * 0.5)) + this.offset.z;
looks like it was a simple mistake?
Hi,
I've noticed the anchor property, specifically changing it, is broken with the plugin, but only after setting the physics of the sprite to iso mode. The sprite's position gets radically changed. If i set the anchor to 0.001 the sprite begins to slowly move to the left (very slow lol) but if i set it to .5 its thousands of pixels away instantly, and does not continue moving.
to replicate:
create a sprite, enable isoArcade phsyics (if you do not do this first there is no problem) do sprite.anchor.setTo(.5); or sprite.anchor+=.5 check the position of the sprite, as its now very far away. For me I got a negative value every time.