Skinned mesh not in the right place after loading a GLTF2 scene


As said in the title, my skinned mesh is not in the right place after loading my .gltf (2) scene: Babylon.js Viewer - Display a 3D model

The character should be inside the room and not far away as it is currently (click on the “Play” button to stop the scene rotation and see the character running).

With threejs the character is in the right location after scene loading: try viewing this file in this site. Zoom in to see better.

I must do something wrong with the mesh / bone matrices / inverse bone matrices / animation data / …, but after several days of tweaking all those data to try to get something working, I finally were able to have this ok in threejs but not in babylon

I think it has something to do with having a transformation (translation) in the mesh node, but I’m not able to make it works without that, and besides it is working in threejs (but maybe it should not?).


adding @bghgary for this one :slight_smile:


Also, I don’t understand why I end up with a skeleton having 17 bones when my mesh has a skin with only 15 bones (joints) defined in the .gltf file…

The root node of the scene and the parent node of my mesh have been created as two additional bones (hence 17=2+15) and have been added to the skeleton: is this the intended behaviour?

i opened your file in blender - and indeed, it looks like the room and character are very far apart in the source file.

i moved them closer together in blender and resaved - and it looks like everything is in order (although very bright when loaded into the babylon viewer ( as i didn’t have your lighting setup) (1.1 MB)

Thanks for looking.

However, I don’t see any translations set on the mesh / sekeleton nodes what would move the object to the right location, so Blender must have changed the vertex coordinates themselves? It’s a way to do it, but I would prefer another way because now the data are in world space, what if I want to copy this mesh and put the copy somewhere else? It’s not easily manageable compared to having the data in its own local space, centered at 0.

i would create two seperate files with both objects at 0,0 and then import them separately…

In fact I have added custom data in the gltf file and use them to set the translation/quaternion on the nodes afterward, as the transform seems to be reset at loading time…

However, I still don’t understand why the skeleton is created with 17 bones instead of 15…