Hello,
I have a Spine object where I am trying to change the position of a bone, but occasionally worldToLocal returns a different position than expected.
I have tried running updateWorldTransform before or after calling worldToLocal and changing the bone position, but it still occasionally returns an incorrect coordinate. This causes the bone to be positioned in a different coordinate from expected.
let position;
if (bone.parent) {
bone.parent.updateWorldTransform();
position = bone.parent.worldToLocal({ x: posX, y: posY });
}
else {
bone.updateWorldTransform();
position = bone.worldToLocal({ x: posX, y: posY });
}
bone.x = position.x / bone.skeleton.scaleX;
bone.y = position.y / bone.skeleton.scaleY;
bone.updateWorldTransform();
I am using the Pixi-Spine runtime.
Any idea what could be causing this?
Thank you!