Freeze Active Meshes and animations

Hello guys, may I have one simple question ? I am using “FreezeActiveMeshes” function to increase performance of my applications. But this feature blocks animations - which is ok. I suppose that it shall be solved by mesh.alwaysSelectAsActiveMesh = true but somehow it does not work. Even when I mark my animated mesh as alwaysActive, it still does not animate :frowning: What am I missing ? Is there another way to “exclude mesh from freezing” ?

I would realy like to have possibility to freeze only meshes I want to freeze and not whole scene actually. But freezeActiveMeshes apparently afffects whole scene.

PG: Babylon.js Playground

Note: you have to scroll to the bottom of code (most of code is embedded model data). If you remove that scene.freezeActiveMeshes(); then model will animate correctly (ugly animation but that is my problem).

Thanx for some insight guys !

When meshes have been frozen in the scene, it exits very early from _evaluateActiveMeshes(): alwaysSelectAsActiveMesh is used later in the process and so won’t be of any use in your case.

https://www.babylonjs-playground.com/#92Y727#3

I freeze meshes after 2s and animations are restarted after 4s without meshes being unfrozen.

I’m unsing skeleton.prepare() to make the animations running “by hand”. It’s what _evaluateActiveMeshes() does, so it can’t be totally off the mark :wink:

2 Likes

Thanx it is working ! I honestly dont exactly know what does it exactly do, but ok :slight_smile: Still I would never figure that out myself and I dont understand why there is no possibility to exclude mesh from freezing (which is otherwise nice feature). But it is workong now, so thanx a lot !