Search Unity

Animation Rigging ChainIK's Weight doesn't behave like 0.5

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

  1. jooij

    jooij

    Joined:
    Mar 27, 2017
    Posts:
    6
    My Environment
    Unity2019.3.10f1 + AnimationRigging0.2.6

    I played around with the ChainIK scene in the Animation Rigging Constraint Samples.

    I set the weight of the Rig to 0.5, but it behaved the same as when the weight = 1.
    I set the Weight of ChainIK to 0.5, and this behavior is the same as Weight=1.
    I'm thinking that when Weight=0.5, it will be an animation between Weight=0 and Weight=1, but is this a wrong understanding?
     
    Last edited: May 2, 2020
  2. btsn

    btsn

    Joined:
    May 12, 2017
    Posts:
    41
    Same problem on Unity2020.1.0b12.3931 and AnimationRigging0.3.3

    ChainIK Rig weight seems to be binary.
     
  3. simonbz

    simonbz

    Unity Technologies

    Joined:
    Sep 28, 2015
    Posts:
    295
    Hi,

    Sorry for the late reply!

    Indeed, we've stumbled on that as well and this will be fixed in an upcoming version. In the meantime, if you want to create your own version of the ChainIK constraint (you can copy files ChainIKConstraint.cs and ChainIKConstraintJob.cs), you can modify the following lines in ChainIKConstraintJob.cs to make it work.

    Code (CSharp):
    1. @@ -46,7 +46,8 @@ namespace UnityEngine.Animations.Rigging
    2.                     {
    3.                         var prevDir = chain[i + 1].GetPosition(stream) - chain[i].GetPosition(stream);
    4.                         var newDir = linkPositions[i + 1] - linkPositions[i];
    5. -                        chain[i].SetRotation(stream, QuaternionExt.FromToRotation(prevDir, newDir) * chain[i].GetRotation(stream));
    6. +                        var rot = chain[i].GetRotation(stream);
    7. +                        chain[i].SetRotation(stream, Quaternion.Lerp(rot, QuaternionExt.FromToRotation(prevDir, newDir) * rot, chainRWeight));
    8.                     }
    9.                 }
     
    Jebtor likes this.
  4. jooij

    jooij

    Joined:
    Mar 27, 2017
    Posts:
    6
    thank for your information.
    wating for next version.