After alpha 24 all animation methods stop working

I was wondering if anything in general changed about triggering code based animations for modules ? Some side effect that needs to be imported maybe ?

Same code and after alpha 24 CreateAndStartAnimation, TransitionTo and new Animation(... stop working in multiple places in our app.

Unfortunately it seems to be fine in PG so far, will keep trying to repro.

Ohhhhhh that sounds pretty bad :frowning: Would you happen to have a small github repro ? I would like to fix it ASAP as I can not think of anything we changed regarding animations :frowning:

2 Likes

Okay I will get one up soon and update here :slight_smile:

1 Like

@sebavan Despite my best efforts ay creating a repro I could not get it. I am testing in our app with just a box and animation like the example there.

The only clue I got out of the exercise is that in the working example, the animatable returned has a value for _localDelayOffset always increasing each time CreateAndStartAnimation is called.

The animateables returned in our app stay null.

Does that small insight about _localDelayOffset give you any ideas ?

Edit: I was digging through the source some and checked scene._activeAnimatables. It’s filling up and never emptying out. ( I have CreateAndStartAnimation on a setInterval )

This is really weird and I can not find an animation playground broken from the doc :frowning:

Maybe @Deltakosh would have an idea ?

Nope and I did not find any related recent changes

I am really digging through the history here :smiley: I found this issue In Animatable.prototype._animate - sometimes the variable _previousRatio and _ratioOffset contains NaN · Issue #4203 · BabylonJS/Babylon.js · GitHub

It seems like it was resolved but @Deltakosh in our app i’m seeing
Screen Shot 2021-07-08 at 3.34.37 PM

I don’t understand much what this value is for yet, any ideas ? Downgrading back to alpha24 and this has a value/animations work.

Is there any way you could share the animation or the code you use? We are not seeing this issue :frowning:

2 Likes

for testing I have right now:

        let box = Mesh.CreateBox("box", 1, scene, true)
        let posx = camera.position.x
        let posz = camera.position.z - 2
        box.position.set(posx, 1, posz)

         setInterval(() => {
             let animateable = Animation.CreateAndStartAnimation("boxmove", box, "position", 30, 30, box.position, new Vector3(posx, 3 * Math.random(), posz), Animation.ANIMATIONLOOPMODE_RELATIVE)
         }, 1000)

I know its very weird, I do not see it in standalone repro above (added two scenes as well, thinking that might have something to do with it) or playground either. It’s something on our end combined with something thats changed in Babylon it seems. Given can flip versions to repro/not.

I am down to messing with the source as a local module now, will let you know if I come up with anything.

1 Like

@sebavan @Deltakosh I found something

in node_modules/@babylonjs/core/Animations/animatable.js

if I comment out:

        // if (this._pendingData.length > 0) {
        //     return;
        // }

animations start working again on version > 24 :rocket: Still don’t understand exactly what is causing it though. Does this help at all ?

This means that you have data not loaded yet. The pendingData property of the scene indicates that you cannot launch animation as not everything is loaded and ready.

You can forcefully empty that array but I would recommend to check what is not loaded yet.

The goal is to avoid hiccups in the animations because if something is done loaded while the animation was started it will force a frame or 2 to drop and thus the animation will not be smooth

2 Likes

Thanks, after waiting and all loading finished, that is always filled up with 26 InternalTexture that seem stuck there, definitely something to look into next for me :slight_smile:

Oh yes :slight_smile: That smells like a leak to me :smiley:

@Deltakosh Is that check on the length something put in after alpha 24 or did anything change in alpha25 you know of that would cause InternalTexture to stay stuck in that array ?

Nothing come to mind honestly:( pinging @Evgeni_Popov if he remembers something along this line

Ideally if you could repro in the PG I would be able to fix it in 20s:(

1 Like

I really don’t know.

The check on the length does exist for at least 2 years, so it’s not the problem.

Only createRawCubeTextureFromUrl and _createTextureBase are adding an InternalTexture instance in the pending array. So the problem would be either the _pendingData is not properly cleaned in some cases, or some textures don’t finish loading… Have you checked in the network tab that there’s no HTTP requests pending that never finishes?

Hmm, just checked, no pending requests in network tab.

I will do my best to start loading and unloading some glbs in my attempted github repro, now that is seems something to do with textures.

1 Like

Can you somehow share a simple repro with the debug bits somewhere?

1 Like

Thank you @Evgeni_Popov for the fix :smiley: I don’t know if I ever would have found this, its been a wild ride looking.

The fix from here: Texture Gamma Space + Node Materials - #10 by Evgeni_Popov

is what ended up fixing animations by the pendingData not being filled with InternalTexture(s)

    SceneLoader.OnPluginActivatedObservable.add(function (loader) {
        if (loader.name === "gltf") {
            loader.useSRGBBuffers = false;
        }
    });

ultimately what fixed it

1 Like

That’s quite strange, as using sRGB buffers should not make a difference… Maybe it’s an interaction with your custom glTF extension?