Strange behaviour when parenting a mesh to a bone (mesh floating far away)

Hello everyone,

Here’s a playground showing the problem : Babylon.js Playground

What I’m trying to do :
Attach the scarfs meshes to the neck bone of the character, so it follows the animations properly (e.g. head movement, turning, etc).

Problem encountered :
Even though the scarfs are parented to the bone, the scarfs spawn far away from the player and move in unexpected ways.

Here’s how the scarfs look after parented (circled in red):

Here’s how it should look:

If anyone knows what might be going wrong, I’d really appreciate your help.
Thanks for helping.

Welcome aboard!

The second parameter of attachToBone must be the mesh the bone is part of. In the PG below, I used the t shirt sans simul.001 mesh. Also, you have to scale up the scarf meshes to counter the 0.01 scaling applied in the transform node hierarchy (see the WALK transform node), and tweak the position X/Y/Z values to position the scarfs at the right location:

2 Likes