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: https://playground.babylonjs.com/#S7E00P#218
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?
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
no worries @bghgary will be able to help soon but please bear with us as this week is particularly busy.
Yeah no worries, take your time I can work with other stuff in the meantime!
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:
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!