Search Unity

SetInputWeight across 3 or more AnimationClipPlayable

Discussion in 'Animation' started by davidseth8, Jan 1, 2018.

  1. davidseth8

    davidseth8

    Joined:
    May 8, 2016
    Posts:
    13
    I can see many examples of mixing two animation clips:

    Code (CSharp):
    1. private void Update()
    2. {
    3.         mixerPlayable.SetInputWeight(0, 1 - blendVal);
    4.         mixerPlayable.SetInputWeight(1, blendVal);
    5. }
    But what do I do when I have 3 or more playables? How do I blend 3 or more weights (blendVal) and ensure they equal 1?

    Code (CSharp):
    1. private void Update()
    2. {
    3.         mixerPlayable.SetInputWeight(0, (?? What goes here));
    4.         mixerPlayable.SetInputWeight(1, (?? What goes here));
    5. mixerPlayable.SetInputWeight(2, (?? What goes here));
    6. }