void Start()
{
skeletonAnimation = GetComponent<SkeletonAnimation>();
skeletonAnimation.UpdateLocal += MoveBoneUpdate;
skeleton = skeletonAnimation.Skeleton;
bone = skeleton.FindBone("jaw");
//Vector2 localPos;
//bone.WorldToLocal(0, 0, out localPos.x, out localPos.y);
//bone.SetLocalPosition(localPos);
//bone.SetPositionSkeletonSpace(localPos);
}
void MoveBoneUpdate(ISkeletonAnimation s)
{
Vector2 localPos;
bone.WorldToLocal(0, 0, out localPos.x, out localPos.y);
bone.SetLocalPosition(localPos);
//bone.SetPositionSkeletonSpace(localPos);
//skeletonAnimation.skeleton.UpdateWorldTransform();
}
I did like you said, but the bone is still flying around. Here is example project https://send.firefox.com/download/f144fd3fe2ddebd9/#NL7_uoUmwsbbqLnI-a4NJg
If i am setting local position only once at Start() it works well only with bone.SetPositionSkeletonSpace(localPos), but SetLocalPosition is setting the bone on wrong place, take a look. Just for notice, parent bone is rotated and i think it causes wrong position.