so i currently have this setup where i have a rig of a character using a spear with a weapon bone which is parented to the root bone of my skeleton. then i also have both left & right hand bone constrainted (child-of) to the weapon bone so that when i animate the weapon bone to do some movements, both of the hands simply follows. it works fine if i don't do anything with the root bone, but once i added root motion stuff, the hand positions simply breaks. i actually know one way to fix it is to bake the animation using visual keying, then adding the rootmotion on the baked animation. but it seems to be such a hassle to do. anyone know the best solution for this?
Objects inherit the transform of their parent(s), then they transform themselves, then they run through their constraints. In general, when you use a child-of constraint, you want to use it on an unparented object or bone, because changing transforms of the parent will change the way that the child-of is evaluated.
In this case, for whatever reason, you want your spear parented to the root bone of the character, but to act as an unparented child-of. That's doable; you just add a layer of abstraction.
Start by making an empty with the same transform as the spear. Give the empty the same child-of target (and other parameters) that the spear has, but leave the empty unparented. Now get rid of the spear child-of constraint and instead give it a copy transforms constraint, on all defaults (world->world is what's important here), targeting your new empty.
Now, the spear will remain parented to your root bone, but its visual transform will be unaffected by that parenting relationship, because it'll be copying the full world-space transforms of the empty which isn't parented to anything.