Search Unity

[Feature Request] or [Bug]? Playables Animation - Linear Extrapolation - Lerp beyond [0,1]

Discussion in 'Animation' started by stiverm, Nov 6, 2019.

  1. stiverm

    stiverm

    Joined:
    Apr 27, 2013
    Posts:
    16
    This may be a fairly fringe feature request. That said: I'm currently looking at doing some procedural animation within Unity's Playable system. I've started by blending several animations (really just key-frames) together. Seems to work well. Trouble is, when I try to blend outside the normalized range I get some unexpected behaviors.

    I'm aware the documentation for SetInputWeight says "Should be between 0 and 1" however I don't know of any mathematical limitation for this. If correct weights are set outside the bounds of 0 and 1 the animation should still look good.

    I.E.
    //alpha = -0.5f
    //1.0f - alpha = 1.5;
    posNew = pos1 * (1.0f - alpha) + pos2 * alpha;
    posNew = pos1 * 1.5f + pos2 * -0.5f;

    Should end up with a point that's along the line but outside of the line-segment between pos1 and pos2. In this case it would be away from pos1 in the direction defined by the vector (pos1 - pos2).normalized.

    It's also possible Unity already does this and I'm making an error in my code.

    Please let me know. Thanks!

    Edit: Made changes to correct math
     
    Last edited: Nov 6, 2019
  2. stiverm

    stiverm

    Joined:
    Apr 27, 2013
    Posts:
    16
  3. stiverm

    stiverm

    Joined:
    Apr 27, 2013
    Posts:
    16
    Alright, I've talked to someone in the know at Unity about this. Turns out because Playables are generic this can't really be done. For example: what does it mean to extrapolate an audio clip? Might be more hope for a solution in the future.

    Hope this helps someone looking for the answer to this odd question.
     
    mutp and Kybernetik like this.