Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[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:
    4
    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:
    4