Well if that solves issues, it would make sense. This is a show stopper, not just for me, but for anyone out there using gltf characters. For example I see that framevr uses v5.0.0-beta.11
I’m not affiliated with any organization, but I know of handful of startups using the code.
So show-stopper for adoption of babylon 5 really.
There was a change from 4.x to 5.x where we changed how the skeletons are constructed in the glTF, but the usage of any of these bone functions is the root cause. These bone functions expect the mesh associated with the skeleton to be passed in. This is necessary because the skeleton maybe applied to multiple skinned meshes with different transforms. What used to happen in v4 is that the whole chain of node transforms was put into the skeleton and that’s why it was okay to not put the associated skinned mesh.
Here is how you could do it in 5.x: https://playground.babylonjs.com/#H925CH#37
This is a similar problem to this issue: Parenting a transform node to a bone
EDIT: another way you can do it (only for glTF) without needing to know which skinned mesh is to use the linked transform node: https://playground.babylonjs.com/#H925CH#38
Really curious to know why you removed the second avatar and hid the axesviewer. =)
@bghgary thanks for the explanation, but the way I see it, root cause is that you don’t see any issues here ![]()
Look how one line of code breaks your ‘solution’ : https://playground.babylonjs.com/#H925CH#39
Now why would I be using container.meshes[1], why not container.meshes[3] or container.meshes[0]? Is there any indicator anywhere to tell me which one is the right mesh? Why not bones[0].getTransformNode() that I was using in the example?
Going off topic, but this entire discussion strongly reminds me of a joke:
A helicopter was flying around above Seattle when an electrical malfunction disabled all of the aircraft’s electronic navigation and communications equipment. Due to the clouds and haze, the pilot could not determine the helicopter’s position and course to fly to the airport. The pilot saw a tall building, flew toward it, circled, drew a handwritten sign, and held it in the helicopter’s window. The pilot’s sign said “WHERE AM I?” in large letters. People in the tall building quickly responded to the aircraft, drew a large sign and held it in a building window. Their sign read: “YOU ARE IN A HELICOPTER.” The pilot smiled, waved, looked at her map, determined the course to steer to SEATAC airport, and landed safely. After they were on the ground, the co-pilot asked the pilot how the “YOU ARE IN A HELICOPTER” sign helped determine their position. The pilot responded “I knew that had to be the Microsoft building because, like their technical support, online help and product documentation, the response they gave me was technically correct, but completely useless.”
is the transform node linked to the bone itself for the animation.
The one you need is the actual root mesh of the skeleton in order to find the position data relative to it.
In your second case, I would guess creating a root mesh impacts the list of generated meshes.
I will let @bghgary provide you with the new example for this.
Thanks @sebavan for the explanation.
Well that’s the thing, how do I find actual root mesh?
Over the last two months you guys keep pointing to some meshes in the array but I don’t understand why would 1 or 2 or 3 - all actual indices used in ‘fixes’ of my playground examples - be actual root mesh.
Ah so I’m supposed to figure out which one is right one among generated meshes? ![]()
Anyway, does that explain right and left side switching places on container.createRootMesh() call?
Anyway here’s another one: https://playground.babylonjs.com/#H925CH#40
So do you see A pose or T pose?
I see A in firefox and T in edge ![]()
Note: I finally got something usable from getAbsolutePosiiton() by using:
left_arm.getTransformNode().computeWorldMatrix(true);
left_arm.computeAbsoluteTransforms();
reusing the transform node will indeed require computing the world matrix first.
I discussed with @bghgary offline and he will update the doc to make all of it clearer and update the thread here once done.
I’ve added docs in this PR: Add “shared skeletons between skinned meshes” section by bghgary · Pull Request #594 · BabylonJS/Documentation (github.com)
Not readable at the moment. Hopefully soon.