Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

two animation clips under one control, why the first one always return to its origin?

Discussion in 'Animation' started by xuchun9000, Dec 28, 2017.

  1. xuchun9000

    xuchun9000

    Joined:
    Feb 24, 2017
    Posts:
    16
    I have two animation clips controlled by one animation controller, they are connected by transition

    what I expected is: when first animation clip finish, the first object stay there, waiting until the second animation finish

    but what I see is: when fist animation clip finish, it start returning to its origin position while the second animation started.

    how can I fix it? where did I do wrong?

    I record a video explaining my question



    thanks
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    The first and easiest way to solve this is to create unique anim controllers for each object. Then stop the animation at the last frame when it is complete. Then play the white animation while the red animation is 'paused' in its last frame.
    You could also create a one frame animation with the red in the up state and transition into that once the upward animation has completed. This still requires unique animation controllers per object.
     
  3. xuchun9000

    xuchun9000

    Joined:
    Feb 24, 2017
    Posts:
    16
    thanks dude, so it's not possible in one controller to achieve the performance I wanted?

    I will try the way you introduced, thanks
     
  4. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    It is possible with an additive animation layer - which I didn't think about before.
    It might work.

    With an additive animation layer - put the animations of the white tile in that layer, set to additive. This will 'add' to the existing animation. So the red tile will stay up when the white tile is moving up. maybe? You might have to create a layer mask for that layer as well. I've only done this with character setups - so not sure if this will work.
    Might need to create a hierarchy - where the two tiles are parented to a master empty game object. But that starts to add complexity to something that should be a simple anim.
    You can also move the individual objects in code - or even easier - use a tweening solution.

    Should be a less complex setup than I suggested above.