- Home /
Apply root motion to bones which are not children of the root motion node
Hello!
I'm having a character rig which contains a weapon. We animate the weapon within Blender. Now we wanna apply root motion. The problem is that it seems like the root motion node must also be the root of all moving bones.
We didn't set the weapon's parent to the root motion node because we thought the weapon is a separate object and not related to the character itself. Also, it's actually not possible to make the weapon a child of the root motion node because then we get Dependency-Cycles in Blender and the animations aren't exported reliably anymore.
In Unity it seems like root motion isn't applied to the weapon. The weapon is always ahead of the character and jumps back to its original position when the animation restarts.
Is there a way to apply root motion for bones which are not children of the root motion node?
Answer by Pinkuboxu · Jun 07, 2018 at 08:00 PM
You are going about it a bit wrong, I think. While the weapon object is a separate object in one way, you should think of your character as containing the weapon object in their hand when it's equipped, therefor in a certain way it's a part of the character. It seems less counter intuitive if you pretend the hand is a container for the weapon. You may want to do it in Unity. Give your character an Empty Object as a weapon slot, positioned and a child at the characters hand transform inside of their armature. Then either place the weapon prefab on that transform manually or have a script that swaps out different weapons. So more directly answering, no, the root motion should always just be for one object and it's children. It's not necessary or advisable to try and move something that isn't part of a root bone family with root motion.
Another way you can do this, If you want to do it more in Blender, you just give the weapon the same armature modifier rig as the characters body rig and make the weapon parent the armature. You can then set the weight of the weapon to the hand bone of the armature. This way the object will be a separate object, at least from the mesh, but it will move with the hand bone. On import to unity it will show up under the same prefab next to the character, but since the animator is on the main component of the prefab, it will move all of the attached objects properly. This way you just apply root motion as usual and everything moves together. You can turn the weapon on and off by activating or deactivating it, repeat these steps for more weapons if needed, and just keep all of your weapons in the same .blend file with your character. You can export in any way that you find a good workflow with. It is also how you'd do different hair, clothing options, accessories, etc.
Your answer
Follow this Question
Related Questions
Mecanim x and z plane root motion not working when importing .fbx, but works with .blend 2 Answers
Rig object offsets during animations 0 Answers
Importing Blender Animations to be played in-game 3 Answers
Blender to Unity - which export format is best? 3 Answers
Adding new Animation to existing Animator not working correctly 0 Answers