Hello,
I just realized by trials and errors that changing AnimationState weights on-the-fly (= outside of Update/LateUpdate loops) does completely screw up any Crossfading based on the ones you changed.
Ex (pseudo code) :
Objective : Sample a transform value from the animation I’m going to Crossfade with Anim1
-
Play(Anim1)
-
change the weight of Anim2 and then Animation.Sample() it
-
Now that Anim2 weight is 1f, Anim1 weight is automatically normalized to 0f,
-
So I have to change Anim1 weight back to 1f, in order to have Anim1 display correctly again
-
Then, launch a Crossfade(Anim2) from Anim1
Result : the crossfading goes completely weird… weird rotations, placements, etc, just as if Anim2 failed to calculate the shortest rotations from Anim1
The only explanation I find from this behaviour is because Quaternion from Anim1 were reset during the Sample() process, therefore Anim2 can’t find a logical follow-up to each animated transform.
So, how are we supposed to deal with mixing Animation.Sample() and Animation.Crossfade() ?