kurhlaa Posted March 7, 2018 Share Posted March 7, 2018 Hello, I've got info that both setting all meshes as active and calling freezeActiveMeshes() should improve the performance, because it turns off some expensive calculations. So I tried to implement this feature. But in my case: 1. If I only call mesh.alwaysSelectAsActiveMesh = true for all meshes - DebugLayer shows smaller potential FPS, by ~100. Should it be like that? I have <100 meshes, nothing very complex. Maybe disabling detecting visible meshes enables some other expensive calculations?! Then I thought that freezing should help with that. But that gave me 2 more problems 2. If I use AssetsManager -> addMeshTask -> loader.onFinish() -> scene.freezeActiveMeshes() I get an error: TypeError: Cannot read property '0' of undefined at t.isInFrustum (babylon.js:8) at t.isInFrustum (babylon.js:8) at r.i.isInFrustum (babylon.js:9) at r.isInFrustum (babylon.js:15) at i._evaluateActiveMeshes (babylon.js:13) at i.freezeActiveMeshes (babylon.js:13) at i.Game.loader.onFinish (index.js:64) at i._decreaseWaitingTasksCount (babylon.js:48) at i (babylon.js:48) at i.e.onDoneCallback (babylon.js:48) What does it mean? In my example - http://www.babylonjs-playground.com/#MPS90E#6 - try to uncomment Line 28 to get the same error. I was hoping to freeze active meshes right after they all were loaded. 3. If I put scene.freezeActiveMeshes() somewhere later - all my actions are disabled/removed, nothing happens when one mesh intersects some other, creation of decals also disappears, particleSystem also doesn't work. Some kind of "freeze the world". Example with intersections only - http://www.babylonjs-playground.com/#MPS90E#6 You see a moving red mesh - when it exits from yellow mesh - "intersection" should appear in the console. But after the first time scene.freezeActiveMeshes() is called and nothing is printed out any more. If you comment out the line 93 - every iteration prints "intersection". Can you please explain what am I doing wrong in these 3 questions and how to fix them? Thanks! Quote Link to comment Share on other sites More sharing options...
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.