I know this is an old discussion, but I landed on this page facing a similar issue.
I'm using Phaser 3.55.2, and I exported skeleton data using Spine 3.8.
Now, this thread helped me a lot, but I was using a camera that followed the protagonist in my game, so I had to compensate for the scrollX
and scrollY
offset, as well as the height of the canvas. This may have been because of my setup, but I hope it can be useful for someone else facing a similar issue in the future.
Here's the code I ended up using to be able to move a bone in the Spine skeleton
const pos = new Phaser.Math.Vector2(
cordX - this.scene.cameras.main.scrollX,
this.scene.cameras.main.scrollY - cordX + this.scene.cameras.main.height
);
skeleton.findBone('root').worldToLocal(pos);
const bone = skeleton.findBone('theBoneToMove');
bone.x = pos.x;
bone.y = pos.y;