Parenting a transform node to a bone

Hi everyone!

I have a parenting issue regarding to some animations and bones. I’m basically trying to add an item to a hand of a game character. This used to somewhat work, but I wonder if something changed during the 5.0. alpha and now, it is a bit borked.

Here is an example of the problem, where I try to add a cube to the hand bone of the character:

As you can see, the cube is parented to a transform node. That node is then attached to the bone. However, it seems that something is wrong and the boxes are far, far away from the character model’s hand… Any ideas? :sweat_smile:

cc @bghgary :slight_smile:

1 Like

Still haven’t managed to find a solution for this… Hard to also debug this in the playground since parenting makes the box/transformnode to disappear from the scene tree…

Also other problem that I previously had was with the scaling when I managed to parent the item to the hand. Trying to achieve the look of the character carrying some item, whether it be a soda can, hamburger or a coffee cup, but I had to arbitrarily scale the item to some random number that might or might not be consistent… Wondering if there is an easier way to do this :thinking:

no worries @bghgary will be able to help soon but please bear with us as this week is particularly busy.

1 Like

Yeah no worries, take your time :slight_smile: I can work with other stuff in the meantime!

1 Like

The second parameter of attachToBone must be the mesh with a skeleton. Here is one way to do it:

If you are using glTF (which creates linked transform nodes from the bones), you can also just attach directly to the linked transform node, which might be a bit simpler:

EDIT: attachToBone must be the mesh with a skeleton (not the parent)


Nice! I ended up using the latter method, since as you said it is a lot simpler! Thanks for the help! :star_struck:

1 Like