Hey, Nate
I don't get it right.
I got a viewport that is 844x390. Spine character is {x: 87, y: 361} and from her hand, it comes lighting that needs to be targeted into an enemy that is placed {x: 422, y: 292}.
If world would be viewport. The enemy cordinates would transfer it to local with the below code.
const cords = vfx.skeleton.findBone("S3-lightning").worldToLocal({x: -335, y:0})
vfx.skeleton.findBone("S3-lightning-target").data.x = cords.x
vfx.skeleton.findBone("S3-lightning-target").data.y = cords.y
Does world mean in this context root bone? When I tried:
vfx.skeleton.findBone("root").worldToLocal({x: -335, y:0}) // returns {x: -335: y: 0 }
Can I somehow calculate bone distance relative to viewport?
My take on it:
Blue dots are character/monster and vfx project roots.
Yellow dots are vfx starting point and ending.
I think vfx ending dot should be calculated by enemy.x(in that case 422) - character.x(87) - vfx.x(49) (distance from root) this value should be transfered by worldToLocal of main bone of lighting strike. Cause of lighting strike is 1288px wide by start and it doesn't show that in his bone.x this diffrence will be subtracted from worldOfLocal. I think it should be perfect ,but for some reasons it isn't.
Screenshot how it looks in game.