How to recalulate skeleton?

Hello,

nobody answered to that thread here (Beginner question: pose editor - rotation - #13 by imperator) to my last question but after many hours of debugging I am trying a new approach so it is better to make a new thread.

I have played around and found out that without attachToBone and by doing calculation like that:

let pos= new BABYLON.Vector3(0, 0, 0)
bone.getAbsolutePositionToRef(mesh,pos );
pos.subtractInPlace(mesh.position);

the spheres are at correct position. but the Gizmos (click on red spheres) are not, see:

So I wanted to go back to attachToBone like in working example (other mesh): https://playground.babylonjs.com//#CN4KJL#93

And my idea was to make new calculations of each bone in skeleton first so that I have the same skeleton as in the working version:
this is my code:

        skeleton.bones.forEach(function (bone) {
            let pos= new BABYLON.Vector3(0, 0, 0)
            bone.getAbsolutePositionToRef(mesh,pos );
            pos.subtractInPlace(mesh.position);
            bone.setPosition(pos)
        })
        skeleton.prepare()

but here the setPosition(pos) is always ignored :pensive:
see:

I just want a working version with correct position and also working Gizmos here how this can be solved doesn’t matter for me. If there are other solution that would be also good.

Thank you!

Please bear with the community who is only here to help… You only asked yesterday.

I answered the question there.

1 Like

Here, you have the same issues, animations interfering and passing a bone to the gizmo instead of the associated transformNode: https://playground.babylonjs.com//#CN4KJL#105

1 Like