Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Do I need new animation or is there other solution? (2d animation)

Discussion in 'Animation' started by PHL1, Jan 17, 2023.

  1. PHL1

    PHL1

    Joined:
    Jul 25, 2017
    Posts:
    29
    Hi everyone,
    I've a 2D character which can take cover and stand in a fixed position. when player starts touching the screen standing animation will play, and when the touch goes to Ended phase, taking cover animation will play. each animation has a 1.5 seconds duration.
    now every thing is ok and works fine but let's say standing animation just begin to play and 10 percent of it has passed then player decides to cancel standing! in this situation playing taking cover animation won't look ok because it will cause a stand snapping to character!
    so what can I do to solve this? should I make new animation for taking cover while standing animation is running or is there another solution like Blend Trees maybe or something else?
    I've the same problem with getting damage while standing or taking cover animation is running! I feel like making an animation for this kind of states won't look ok every time bc player might decide to sit at anytime when standing animation is running so the problem mentioned earlier would still happen sometimes. btw I'm using animation rigging.
     

    Attached Files:

    • 1.PNG
      1.PNG
      File size:
      81.5 KB
      Views:
      88
    Last edited: Jan 18, 2023
  2. clownhunter

    clownhunter

    Joined:
    May 26, 2013
    Posts:
    61
    The Interruption Source property on the animation transition can help blend the Idle -> Stand transition to the Stand -> Idle transition smoothly: https://blog.unity.com/technology/wait-ive-changed-my-mind-state-machine-transition-interruptions.

    Not sure about 2D, but if you're doing the animation rigging where there's bones, then animating hit reactions as additive animations that sit on another layer and play "over" the Idle/Stand layer will help them blend on top of the transitional animations as well. (I haven't done much with the 2D bones stuff, so I'm not 100% sure on this, but that's how it works with 3D)
     
  3. Noodle_Meanie

    Noodle_Meanie

    Joined:
    Sep 11, 2021
    Posts:
    110
    In the animator, try clicking on both the arrows going to, and from the standing state and set the "Transition duration" to 0. I hope that helps.
     
  4. PHL1

    PHL1

    Joined:
    Jul 25, 2017
    Posts:
    29
    interruption source is for mid transition and that's ok, and i'm asking whether to create another animation for the best blending between standing and sitting or vise versa, or do other stuff. i'll check for additive animations you explained.
     
  5. PHL1

    PHL1

    Joined:
    Jul 25, 2017
    Posts:
    29
    i've uploaded anim controller. it's already 0.
     
  6. PHL1

    PHL1

    Joined:
    Jul 25, 2017
    Posts:
    29
    fixed the problem in standing and sitting with creating 2 transition for these 2 states and playing around with transition offset and transition duration.