Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

2D Sprite with multiple body parts

Discussion in 'Animation' started by trakof, Jan 23, 2014.

  1. trakof

    trakof

    Joined:
    May 12, 2013
    Posts:
    2
    Hi, I'm trying to create some animations for a character with separate body parts. It's divided up into legs/torso, left arm, right arm and head. I've tried doing it 2 ways, using 1 animator on a parent object or using a different animator on each part that needs animating.

    Using 1 animator to animate all the parts together would require creating tons of animations for things like running while attacking, jumping while attacking, "idle" while attacking etc..

    Using an animator for each body part even with identical state machines seems to just not work properly. The timing gets skewed making incorrect frames to go together and things being positioned wrong. Creating the animations is also a huge pain because I can't see the correct frames for the other body parts while working on another.

    Is there some other way I'm not thinking of? Or maybe a better way to go about one of those 2 methods?

    Thanks.
     
  2. Aedous

    Aedous

    Joined:
    Jun 20, 2009
    Posts:
    244
    Hey Trakof, funny you mentioned that because I am doing the same thing that your doing, I actually was going to try the first method out and try matching everything up with one animator. I think that is a better way because everything is organised into one, and you may be able to actually play two animations at the same time with AvatarMasks, reading your post gave me the idea and I found this :

    http://answers.unity3d.com/questions/558909/unity-mecanim-two-animations-at-once.html

    I haven't tried it yet, but I was trying to figure out how to blend animations together but only use one animator, because having multiple animators seems to have an off timing, in my case because I'm switching game object bones to use for an 8 directional sprite, hope that helps, will post back if I found a good way to do it.
     
  3. eezSZI

    eezSZI

    Joined:
    Nov 16, 2012
    Posts:
    121
    For things like running while attacking etc you could use "layers" in the animator. I believe you can give them weights so you could have a run animation that normally affects all sprites, but then have another layer for fighting that affects just the arms and head.

    http://docs.unity3d.com/Documentation/Manual/AnimationLayers.html

    I'm new to all of this as well, but perhaps that will help.
     
  4. Aedous

    Aedous

    Joined:
    Jun 20, 2009
    Posts:
    244
    I think that actually solves the problem, layers and avatar masks, it's a shame animation sync is only in the pro version :(.
     
  5. trakof

    trakof

    Joined:
    May 12, 2013
    Posts:
    2
    Sounds exactly like what I needed, thanks guys.
     
  6. JUSTLXO

    JUSTLXO

    Joined:
    Nov 27, 2021
    Posts:
    1
    Hey could you tell me how to actually combine different parts for example in a character customization menu. I would like arrows to switch and change, for example, the head and other body parts. Then a save button should allow for that combination to be saved and loaded into a game.
     
  7. Ted_Wikman

    Ted_Wikman

    Unity Technologies

    Joined:
    Oct 7, 2019
    Posts:
    906
    @leojbenny1 this thread is from 2014. Please create a new one and highlight your current issue and what you would like to get help with.