Search Unity

How to blend in IK constraint

Discussion in 'Animation Rigging' started by DrummerB, May 1, 2020.

  1. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    I'm trying to define poses using IK constraints and then blend between these poses. If I animate the weight of such an IK rig, it looks like the system is animating the IK targets and hints, instead of determining the IK constrained pose and then blending the rotations of the bones. This results in an unnatural animation between the poses:



    At the beginning of the animation, the root bones of the fingers bend UP, in the opposite direction of the fully constrained pose. Also, the fingertips bend up.

    Am I using the system incorrectly? Is there a better way to blend between IK constraint-based poses?
     
  2. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    The rigging graph always evaluate as a post-process to the animation graph (the state machine, the timeline or custom playable graph). This means that IK will always evaluate after poses have been blended together.

    To do what you're asking, you'd need more open control on the animation graph to let you solve the IK before your poses are blended in the animation graph. Unfortunately, this is not something that will be tackled by Animation Rigging.

    Instead, you could try out bi-directional motion transfer in version 0.3.x of the Animation Rigging package for Unity 2020.1. This would allow you to keyframe your rig with IK controls and then bake it back to FK to evaluate without constraints afterwards.

    https://docs.unity3d.com/Packages/c...g@0.3/manual/BidirectionalMotionTransfer.html

    Hope this helps.
     
  3. DrummerB

    DrummerB

    Joined:
    Dec 19, 2013
    Posts:
    135
    Thanks for the response, Simon!

    I'm not using any baked animations (the controller on the Animator is null). I just want to define some static grab poses and blend between them. Maybe using the Animation Rigging package is the wrong approach for this. But it would give me some nice possibilities for more dynamic poses, such as constraining the index finger to a weapon's trigger. I just couldn't yet figure out how to feed it with programmatically generated poses/frames, instead of animations.

    I could probably use single frame "animations" to feed to the Animation Rigging, but this seems like a hacky solution to me. I've been looking into implementing it as a custom constraint instead and adding it before the IK constraint. This would probably work, but I couldn't figure out how to integrate my HandPose asset with the Job system, without declaring 15+ transform handles for the job.

    I then looked into implementing it as a Playable instead that should just feed a blended pose to the Animation Rigging system. I think this might work, but documentation on the Playable system is minimal, with no good examples, apart from how to combine existing Playables.
     
  4. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    121
    Hi guys, @simonbz does Unity plans to fix it for humanoid avatar rigs? Unity 2022 LTS, Animation Rigging 1.3 and still not compatible, we have to redo all animations