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 How to efficiently transition between random poses?

Discussion in 'Animation' started by ttrs, Dec 30, 2022.

  1. ttrs

    ttrs

    Joined:
    Jul 16, 2021
    Posts:
    2
    I have a 3d character and I would like it to smoothly and realistically transition between several hand gestures or poses depending on some event triggers. But I have a bit of a problem wrapping my head around how to do so most efficiently. Maybe there's a much better way of doing this I'm not aware of.

    I was thinking would probably get the best looking result if I create separate animation that transition from one pose to another. For example:

    Idle > PoseA; Idle > PoseB; Idle > PoseC;
    PoseA > Idle; PoseA > PoseB; PoseA > PoseC;
    PoseB > Idle; PoseB > PoseA; PoseB > PoseC;
    PoseC > Idle; PoseC > PoseA; PoseC > PoseB;

    That's 12 animations for just 4 poses and I would like to add more in the future, so that approach does not seem very sensible.

    Then next idea was adding all the poses (2 frame clips with no visible animation changes - using only 1 frame results in issues) to the animator and transitioning between them with Animator.CrossFade(). The issue with this approach is that I don't know how to fine tune the interpolation between poses.
    The script just uses linear interpolation and the transitions look very stiff. I would like to somehow add curves to drive the transition and make it feel more natural, but I haven't found a way.

    Another thing I would like to do is transition to another pose in between transitions.

    So for example let's say the transition between poses takes 10 frames going from Idle to PoseA. At frame 7 a trigger happens that demands the transition to PoseC. I would like to stop the initial transition and use this as a starting point to get to PoseC.

    Code (csharp):
    1.  
    2.      oooooooxxx
    3. Idle >>>>>>>>>> PoseA
    4.            |
    5.            |oooooooooo
    6.            |>>>>>>>>>> PoseC
    7.  
    Not sure if that's achievable with CrossFade().

    The final idea I had was putting each pose into a separate layer of the Animator Controller and using code to manipulate the weights of each layer depending on what pose I want to transition to. This works fairly well, but I'm hesitant with this approach because it would create several layers that would soon become difficult to manage as I and more poses. If I add another hand and also use the Animator Controller to manage other animations it's just a matter of time before getting lost in the sea of layers.

    I'm looking for suggestions on how to best transition between these several poses.
     
    Last edited: Dec 30, 2022
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    2,495
    This is what I do:

    Idle on layer 0. Always there, always full weight, and protects you from going T-Pose.

    Any full-body poses/animations on layer 1. Go full weight unless there is none. This includes "fidgets", those special idle animations like stretching, slouching, etc. If you go from PoseA to PoseB, just do the crossfade. You're only talking a few frames, there's not much to fine tune about interpolation.

    Any upper-body poses on layer 2, with an avatar to mask it so it applies only on the upper body. Go full weight unless there is none. This is for carrying two-handed weapons or other PVE interactions that don't affect your ability to walk around.