Search Unity

Animation: Attached to where in hierarchy?

Discussion in 'Editor & General Support' started by Richard_B, Jul 31, 2005.

  1. Richard_B

    Richard_B

    Joined:
    Jul 22, 2005
    Posts:
    436
    Sorry - I seem to be flooding the forums :( I am confused as to where in the hierarchy and animation clip should live. When you import and rig that is animated there is the option for the clip to be attached to the root or in the nodes. Anyone understand the difference? In Maya if I say animate a transform node that an object is attached to (say a door), but that transform node is burried down the hierachy a little (see http://otee.dk/forum/viewtopic.php?t=334 ). Does the animation clip you get upon importing always animate the original transform node no matter which gameobject it is a component of?

    many thanks,
    Richard.
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Lets say you have animation of an arm and a hand in maya.
    Hand is a child of arm.

    In maya you make 2 animations. One for the arm, one for the hand.
    In a game scenario you mostly want to play both of them at the same time.

    Thus store animation in root node wil combine all animation clips and store it as a single clip in the root node.

    This way when you script animations, you make one script call
    animation.Animate ("Run");
    and it will start animating a lot of nodes at the same time.

    If you have store animation in root node disabled. You will end up with a lot of separate animation clips. So if you want to play the animation of the hand, you have to get to the hand animation component first and then play the animation and it will only play the hand animation and no other animation.
    Code (csharp):
    1.  
    2. transform.FindChild ("Hand").animation.Play ("Run");
    3.  
    This gives you more control but in a game setting using this is very rare.
     
  3. Richard_B

    Richard_B

    Joined:
    Jul 22, 2005
    Posts:
    436
    Ok - got it - thanks (also for the sysntax for finding the child - I was having problems with that).

    cheers,
    Richard.