unity-game-engineanimation

How to add an gameobject to an animated rig properly


I have moddeled and rigged an human in blender and I am able to play that animation in unity. Now I am trying to add some objects to the human. For example an hat. But I cannot figure out, how it is made that the hat moves withe the animation.

I know, that the head has got the animation data. The hat does those data not have, hence the hat does not move.

How do I do this? Another scenario would be grapping sth. with the hand and that object should move together with the hand movement.

enter image description here enter image description here

I would like to add those objects via script later on.

Thank you very much :)


Solution

  • In your character's rig in the unity scene,

    Find the Bone that you want your target GameObject to follow, and add the target GameObject as a child of the bone GameObject in the Scene heirarchy, and position it with whatever position and rotation offset you need (In this case, on the head bone, maybe a little tipped)

    In this case, you would find the Head bone of your rig, and add the Hat as a child gameobject of the head bone. Any animation you play, which modifies the bone positions should also move your target GameObject.