Hi,
I’m a newbie. I’m making player aim and shoot. I use findBone function to find crosshair to aim. When I call worldToLocal to convert from target world position to bone local position but result NaN. I use spineboy-pro and CocosCreator 3.7 to test. This is my code:
this.spine?.setAnimation(1, 'aim', true);
let crosshair = this.spine?.findBone('crosshair');
let targetPos = new sp.spine.Vector2(this.aimTarget.worldPosition.x, this.aimTarget.worldPosition.y);
if(crosshair)
{
crosshair.parent.worldToLocal(targetPos);
console.log(targetPos);
crosshair.x = targetPos.x;
crosshair.y = targetPos.y
}
And log targetPos: Vector2 {x: NaN, y: NaN}
Please help!