Search Unity

  1. Get the latest news, tutorials and offers directly to your inbox with our newsletters. Sign up now.
    Dismiss Notice

Override existing animation with IK!

Discussion in 'Animation Previews' started by GilbertoBitt, Apr 21, 2019.

  1. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    106
    I wonder how to do this kind of things! ps: sorry the noob question.
    i want to download existing mecanin animation and override using the Two Bone IK to override (without deleting all animation clip) but add an override similar to what UMotion do.
    example:


    has you can see on UMotion we have Layer of type override to replace animation only the hands! i want to know if somehow i'm able to make the same effect without love or rewrite, delete keyframes from the existing animation.
     
  2. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    737
    Generally, any of the IK solutions will do this sort of thing, but the details differ a little bit. In addition, there are ways to mask off certain bones in the animator.

    First, combining animations: the animator controller picks one or more animation clips and combines their results. You can have animation clips for "walking forward", and for "turning left while walking," and the animation controller can mix those two animations to get a pretty convincing "turning just a little bit left while walking."

    https://docs.unity3d.com/Manual/AnimatorControllers.html

    Next, combining only parts of animations on parts of the body. In addition, you may mix in animation clips for "looking around" and "waving at the crowds". If those animations ONLY include keyframes for the hands and head, then they can be mixed in with no further effort. If those animations also include the legs, then they would obviously mess up the walking animations. So you generate an avatar mask which is basically a way to explain which bones should be considered and which bones should be ignored in an animation clip. The animator controller can then use that avatar mask to filter the imported animation clips and create separate layers for "upper body animations" and "whole body" animations, etc.

    https://docs.unity3d.com/Manual/class-AvatarMask.html

    Next, overriding the animations based on other circumstances. The animation stage is about finding the ideal locations of bones based on animation clips. All of this is typically performed at the
    Update()
    stage of each frame. If you were to wait until after the Update stage, say, by writing a script that moves bones in the
    LateUpdate()
    method, then those movements would take precedence. For example, enforcing foot placement on a bumpy ground, or not letting an axe swing through a wall. Just about all of the IK systems will try to work in this timeframe for typical animations. (More tricky physics-based animations may need to be computed more often, and will take place in a separate
    FixedUpdate()
    stage of the execution.)

    https://docs.unity3d.com/Manual/ExecutionOrder.html
     
  3. GilbertoBitt

    GilbertoBitt

    Joined:
    May 27, 2013
    Posts:
    106
    thank's, i will try create layers that override existing avatar and change avatar mask accordinly.
     
unityunity