Skip to main content

Attaching Object in Animation

If you have an animated character, you may want to incorporate some other object in its animation. For example you may want to give your character a sword. However, you want the sword to move when the animated character’s hand moves.

This is possible by taking advantage of the skeleton entity that is generated for you upon conversion.

🤺

The skeleton entity mirrors the skeleton, and all the bones of the skeleton fall underneath it. Those bone entities will be given the actual bones’ animated transforms at each frame.

If you add other entities in the skeleton entity hierarchy, those entities will be impacted by the animation as well.

🤺

If you want to give your character a sword, you could add a sword entity underneath its right hand bone, so that its transform is affected by the right hand bone animation.

For all this to work, just make sure that the skeleton root bone entity is well plugged into the animation controller in the “RootBoneEntityRef” slot (if not, just drag the entity to it). F.y.i. the root bone entity has a skeleton reference and a bone reference with a bone index of 0.

Example:

Problem: I want my sword to move with this animation…

not so cool angel.gif

Solution:

First I place my sword in the skeleton hierarchy where I want it (under the RightHand bone makes sense). Then I position my sword exactly where I want it with my character in T Pose, as it is easier to do so in T Pose than if it’s animating. Quick way to put your character in TPose is to remove the animation graph from the animation controller temporarily.

First I place my sword in the skeleton hierarchy where I want it (under the RightHand bone makes sense). Then I position my sword exactly where I want it with my character in T Pose, as it is easier to do so in T Pose than if it’s animating. Quick way to put your character in TPose is to remove the animation graph from the animation controller temporarily.

Then once my animation is running again, voila! Sword moves

Then once my animation is running again, voila! Sword moves