Play animation in a variable out of the glfLoader

Greetings!

I would like to save an animation inside a variable to play or stop it outside the gltfloader:
For example:
This works…

But if I do this…

So run.play doesn’t work because outside of the gltfLoader run is undefined.

I would like to be able to store that value in a variable that I can use outside to export it and call it from another script.

It’s possible?

That’s most likely because load is an asynchronous function, you declare run, then you schedule loading, then you try to play run which is still undefined, then, much later, onLoad event happens that fills in run with clipAction but you don’t play it afterwards.

You can use run but only after onLoad event have fired.

1 Like

Hi!

Just try ro check if run defined in tick function AS ONE TIME