Does the engine stop/pause non visible models animation?

I’m wondering, does the engine stop/pause animations on models that are not seen from the current camera? And plays automatically if we see them again?

It doesn’t, no.

1 Like

Thanks for the info!

There is also a feature request on this: Expose option to disable animation playback on invisible characters · Issue #3563 · playcanvas/engine · GitHub

@yaustar @Leonidas can we access Application instance through the web worker? I know that web workers don’t have DOM access so would like to know the limitations of workers. If a worker has direct access to the app instance we could set an interval and check every N milliseconds those hidden models and stop animations?

Not sure about Web Workers but I don’t see why you couldn’t phrase this over several frames on the main thread.

2 Likes

No you can’t access on the main thread any kind of JavaScript object, including the PlayCanvas application instance, directly from a web worker. There are ways to communicate between the two threads and share/transfer data (objects and other primitive types). But none would allow you to access the PlayCanvas app instance directly.

For something like that, as Yaustar suggests, you don’t really need web workers. You can do so in the main thread.

1 Like