Hello, Nate! First, Thanks you again for your reply! Although i already saw your reply as soon as it was posted, I wanted to reply back again when i find any solution for it.
And you know what? I solved it! I was so dumb!
When i first saw this issue, (I think it's not issue, but more like my misunderstanding of spine api..) i really had no idea what causes this, so i decided to read api reference again and again (which i already read before)
Then I found some interesting section called 'Procedure Animaton', which i thought related : http://esotericsoftware.com/spine-runtime-skeletons
It said :
It is common to apply an animation, then adjust the bones:
Bone torso = skeleton.findBone("torso");
...
state.update(delta);
state.apply(skeleton);
torso.rotation = ... // compute rotation for torso
skeleton.updateWorldTransform();
renderSkeleton(skeleton);
}
If the world transform from the animation pose is may be needed to adjust the bone, updateWorldTransform can be called before the adjustment, then again after the local transform is changed:
Bone torso = skeleton.findBone("torso");
...
state.update(delta);
state.apply(skeleton);
skeleton.updateWorldTransform();
torso.rotation = ... // compute rotation for torso
skeleton.updateWorldTransform();
renderSkeleton(skeleton);
In the second paragraph, as you can see "updateWorldTransform()" method is used twice.
According to the explanation above, the reason for this is..
"If the world transform from the animation pose is may be needed to adjust the bone, updateWorldTransform can be called before the adjustment."
I did follow this trick, since i was using worldToLocal method, which in my guess will use world transform data in calculation...
And I made a video that shows 3 different version, including -
- what if i put updateWorldTransform before?
- or only after?
- or both before after? (which is the one i described above).
Damn! It's working! I can't believe how this simple change made the difference..
My hypothesis for this, is that,
- spine.skeleton only has transformation values in local axis, not world axis.
- But to render it out using spine.webgl.SkeletonRenderer, all bones' transform values should be calculated to world axis, using which bone is parent to which, and every local values.
- And, As well as rendering, every functions whose name begin with 'WorldToLocal" must be executed after updateWorldTransform()!
My assumption could be wrong. Please let me know if anything i am getting it wrong!
Also, Here's another question. even if worldToLocal requires updating world transform in advance, i still don't get why the first example and second example show such result in above video.
Why first one(updating world transform only before manual bone move) is not applied at all, and why second one(updating world transform only after manual bone move) is showing undesirable, unexpected randomly moving bone?
This test gives me a lot of question... Problem is solved, but still i am curious alot.
Please help me understanding Spine Runtime API further.!