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

Question 2D Animation | Hide Bone mesh in runtime OR combine bones from two rigs

Discussion in 'Animation' started by aklgupta, May 19, 2020.

  1. aklgupta

    aklgupta

    Joined:
    Jun 9, 2014
    Posts:
    29
    Intro/What I trying to do:
    I have a 2D character which is animated. This character changes clothes and some accessories randomly too. I am using skeletal animation to animate the character, and would prefer having a single animation control the clothes and accessories too.
    This means, I want the random clothes and accessories to be layered/sorted properly, and only be visible when they need to be.
    Making separate sprite for each combination is not possible, as there are a lot of combinations.

    Layering:
    At the bottom the torso and legs, then accessories, then clothes, and the upper most layer is hands.

    Issue:
    I can't find a good way to layer them and animate them easily at the same time, without using "hacky" ways.

    What I have tried:
    1. The issue is that if I use multiple images with "Sorting Group", then it becomes very easy to layer them, but afaik it is not possible to connect across multiple images, which makes animating the character near impossible. IK too doesn't work in this case.
    2. If I treat the sprite sheet as a single images and create disjoint geometry/mesh for clothes and the character body, then I can layer them using bone depth and animated them too. However, it is not possible to hide the "mesh" of a bone in runtime. The only solution I have seen so far is to set the scale of the bone to 0 in order to hide it.

    Though the second methods is the better of the two imo, I don't like the idea of setting the scale to 0 to hide a particular part of the image. It means the mesh is still being rendered, but just at 0 scale.

    Is there a way to achieve what I want without the said pitfalls? Either disable a bone mesh, or combine two rigs?

    Thanks.
     
    P10tr3k likes this.