Animation blending questions (blend speed, and scrubbing)

Hello,

We are trying to work out good values to use with our animations and blending our outros into intros (avoid returning to idle pose) and whilst we have the code working, picking what time and what speed is not trivial for us. a few questions - one should hopefully have an easy answer, the other might not.

Regarding ‘blend speed’ what is it actually doing? we can’t quite seem to work out exactly what the value relates to? is it the value of a slope when the animation ramps up for 0 to 100 in weight, is it somehow related to the easing function, is there something else i’m missing? - what does a value of 0.03 mean vs a value of 0.07 etc?

Somewhat more involved question - as it stands we need to pick the ‘end time’ as well as ‘blend speed’ that gives a good look for the animations and whilst changing numbers and hitting play can work, is it possible to advance animations forward and backwards so that i could pause animations after the transition, and then roll back through those animations and advance them again - this obviously assumes i have a UI to interact with this, i’m more questioning if the functionality could be implemented within the animation handling (will negative or positive values to ‘last animation time’ accurately work with blendings etc?

thanks for the help - also open to suggestions if people have ideas about better ways to do the latter half, or ways supported if this way is not.

Rdpeake

summoning @Deltakosh

Hey!

Blend speed is used this way:

  • On every frame, the blendingFactor value (starting at 0) is incremented by blendingSpeed
  • The blendingFactor is used to determine how much of each animation we take in account:
    finalValue = blendingFactor * newAnimation + (1.0 - blendingFactor) * previousAnimation

Here: Babylon.js/runtimeAnimation.ts at master · BabylonJS/Babylon.js (github.com)
and there:
Babylon.js/runtimeAnimation.ts at master · BabylonJS/Babylon.js (github.com)

For your other question, I believe it should work as I do not see a reason why it wouldn’t but ideally I would need a PG to better understand the situation (maybe trying to hack what you want to do with this one: prova | Babylon.js Playground (babylonjs.com)

1 Like

hey,

Thanks for the links to the source for how blending speed is used.

regarding my second question… it’s somewhat hard to describe, but the linked playground doesn’t use blending speed at all, so it wouldn’t really be hacking something in. The basic idea of what i would be wanting to try is playing 2 animations backward and forward, pausing when either animation reaches its start or end (and before it gets removed from the animation queue).

what i’m wanting to set up is 2 overlapping animations - when animationTimeScale is > 0, everything plays forward until the first animation would end and then animationTimeScale is set to 0, and animation 1 is not reset, such that setting animationTimeScale to < 0 would play both animations backward until the second animation reaches its start frame, and again setting animationTimeScale to 0 to freeze the animations.

Do i just need to tap into the onBeforeAnimation observable, and check a value on the 2 animatables or would i be too late at that point to prevent the animations from being reset, or going past the start frame?

Maybe there is a more deterministic way to set these values? but without that, being able to easily play back and forth with different values would be handy. I already have the inspector custom properties set up to be able to push values in and otherwise interact.

Hopefully i’m making sense and thanks for the help,

Rdpeake

My PG defines blendingSpeed at line #50 :slight_smile:

What you want can probably be done with OnAnimationEnd, like in this topic:
Yoyo/mirror looping - Feature requests - Babylon.js (babylonjs.com)

Hello just checking in, was your question answered? @rdpeake