Child meshes with bones as parent issue

Hi there,

Can someone please help with this issue? I might be missing something here as this worked in the previous BJS version. I have a character with child meshes attached/parented to its bones.

When the character moves in my game the child meshes don’t move with the character. See the images below.

I tested my character in BJS viewer and all works as expected but not when loaded into my game.

Is there a way to make sure that parented meshes stay in their positions and also move with the character when animated or controlled with a gamepad/joystick?

If the images aren’t enough, I will work on the playground version, many thanks.

BJS Viewer


Yes, for this kind of issue, a PG would help a lot!
when opened in bjs sandbox, can you move the character using the inspector and get the glasses to follow?
I’m trying to know if it’s an asset problem.

Same issue in BJS viewer as well.

Then it’s an asset issue. can you upload your mesh ? or at least take a screen shot of the hiearchy?
Is there any thing else that should be checked @PatrickRyan ?

You can grab the file from here

It should work if you manipulate the root

1 Like

Do you mean to use code to manipulate the root? If so how? Do you mean __root__ of the glb file?

The asset you gave the link for does not contain the glasses / gloves / shoes?

Apologies, you can grab from here

to me, little boxes or glasses, if you want to manipulate the character, you should change its __root__ transform

Hi @Cedric, I previously replied from my phone so didn’t notice the image. Still not sure on how to manipulate the __root__ to get all child meshes to retail their positions and move with the character physics.

_root is a transform node, so you can translate or rotate it with Babylon.js docs for example.

1 Like

I managed to get it working by adding the __root__ as a child of Mesh and controlling that mesh> Works well for my game, thanks guys!.

1 Like

My previous solution was not sufficient, so I updated my code to use the GLB [root] as advised by @Cedric and is working perfectly now. You can control all the attached meshes by just manipulating the _root of a .glb mesh. Thanks again @Cedric

1 Like