Search Unity

Best practice for blending an extreme animation to another.

Discussion in 'Animation' started by cjddmut, Jan 31, 2014.

  1. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    120
    I have a character that when it walks or runs it takes large exaggerated strides. I have created a slow walk, a normal walk, and a run. These blend pretty well together and it looks pretty good from idle into moving. However, since the strides are so exaggerated, it can be very weird if the legs are spread far apart and the speed quickly goes to zero triggering the idle animation (the feet will effectively slide into place).

    I'm a bit lost on how to best solve this issue and was hoping someone could suggest the appropriate (or a possible) route to consider.

    Thanks!
    C.J.
     
  2. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,060
    Does it look any better if you reduce the speed over a longer duration (i.e., slower transition)? Maybe the player won't mind having to take a little longer to slow to an idle.

    Unfortunately, I think this is why animators spend a lot of time creating custom transition clips. You can't always make it look realistic procedurally.
     
  3. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    120
    I'm ok with the idea of creating custom transition clips as slowing down the transition isn't a great option for me. It does seem to me that I would need multiple transition clips so that I can play (or blend) the appropriate clip depending on what point in the locomotion animation the character was in.

    What's the best way to determine which transition clip to play? I could set up events in the locomotion animation that will let the script know which part of the animation we are in so that as speed hits zero a certain boolean is set to true and mecanim will transition to the correct transition animation. However, this seems a little clunky and I'm curious if there is a better supported or more intuitive way to do this.

    Thanks!
    C.J.
     
  4. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,060
    My preference is generally to let parameters in the animation controller dictate which transitions to follow as you described, but you could also manually trigger a state by using Unity 4.3's new Animator.CrossFade() or Animator.Play() methods.
     
  5. 3DCWCURTO

    3DCWCURTO

    Joined:
    Dec 30, 2012
    Posts:
    19
    I was trying to get my transitions to idle to look better a few weeks ago.

    After looking at some assets I purchased and the mecanim example scenes that are free I noticed a few things. If your idle has the feet together the transitions will look better if your starting frame for the runs and walks have the feet apart. When stopping your character should stop on the front foot and the back leg will slide forward to meet it which looks pretty nice and is pretty close to what a real person would do. Generally I also make sure the same leg is being lifted off the ground first for any direction the character moves.

    -parallel blend trees for the walk and run can help. Or a 2d blendtree.
    -if you don't have strafing setting a forward animation to negative speed makes switching directions look pretty good
    -I also experimented with a stopstep triggered by a transition event. Wasn't happy with the results.
     
  6. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    120
    In order to have your character always stop on the front foot then the transform point should always be over the leading foot. I'm pretty new to animations but maybe this is what is normally done?
     
  7. TonyLi

    TonyLi

    Joined:
    Apr 10, 2012
    Posts:
    10,060
    You can also play with Mixamo's huge library of transition animations on http://www.mixamo.com/ or the in-Unity Mixamo Store to see how they work even if you don't end up buying them.
     
  8. cjddmut

    cjddmut

    Joined:
    Nov 19, 2012
    Posts:
    120
    Cool, thanks for all the information!
     
unityunity