Search Unity

How does animationclips blend? I want 2 know the fumula...

Discussion in 'Scripting' started by JohnSonLi, Jul 26, 2016.

  1. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    for a property (say position.x) of a gameobject in two clips at a giventime:
    is it like this:
    valueAfterBlend = clip1.curvePosX.getValue(t) * weight1 + clip2.curvePosX.getValue(t) * weight2
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,412
  3. DavidGeoffroy

    DavidGeoffroy

    Unity Technologies

    Joined:
    Sep 9, 2014
    Posts:
    542
    Do you mean during a transition?

    During a transition, every curve is basically lerped (https://en.wikipedia.org/wiki/Linear_interpolation)

    e.g.: result = animation1Value* (1-T) + animation2Value(T), where T is the proportion of the transition that has been accomplished [0..1]
     
  4. JohnSonLi

    JohnSonLi

    Joined:
    Apr 15, 2012
    Posts:
    586
    so basically what you told me is just like what I thought.
     
  5. jkngvuu

    jkngvuu

    Joined:
    Jul 1, 2023
    Posts:
    1
    @DavidGeoffroy Sorry for the necro post but I thought It's still relevent, could you share which method Unity uses for 2D Freeform Directional?

    Is it one of these or one not covered in the thesis you sent?
    Inverse Distance Weighted Interpolation,
    Natural Neighbors Interpolation,
    Cardinal Radial Basis Functions,
    K-Nearest-Neighbors,
    Densely Sampled Parameter Space,
    Gradient Band Interpolation,
    Gradient Bands in Polar Space,

    I'm attempting to replicate a similar system in an engine I'm writing in my free time but I'm not sure which method Unity uses and don't want to spend my time implementing each and then comparing.

    Thanks for your time!