Problem Combining Scenes with Timeout routines

I don’t think I’m encountering a bug, but i don’t understand the setTimeout() functions used in the PGs.

I am modifying this basic scene with 3 frames (scenes): https://playground.babylonjs.com/#0S6R4I#14
In frame-2 (STEP 2) I want to zoom between TWO scenes which i have created as scenes[4] and scenes[5].

Example ZOOM: scene0 - Square /scene1-Cylinder.
PG: https://www.babylonjs-playground.com/#MXCRPS#70

Note - PG above uses 3 scenes: (0, 1, 2). scene2 combines scene0 and scene1 with a toggle button.

I think the two Timeout() functions are colliding. I tried combining the two into one function, and it failed. Next, I tried to use a separate SWITCH statement to render each button-click. But It always hangs when rendering scene-1 (Cylinder).

Can someone suggest how to integrate the 3-scene FRAME version, with the 2-scene ZOOM version? I think the setTimeout() functions are the issue because I cannot merge them.

I am not too sure what you are trying to do :frowning:

Could you detail what you are trying to achieve a bit more ? and we could try to figure the best approach ?

The code is pretty hard to follow :slight_smile:

Could you simplify to the min number of scenes, with only one mesh inside or even just clear color ?

This should help track down the problem.

I removed some of the extra elements - it’s simpler to follow. Nearly similar to the two (basic) PGs mentioned above. Labels inserted for guidance: 3 transition frames/scenes and 2 zoom scenes.

simplest modified 2-zoom scenes: https://www.babylonjs-playground.com/#MXCRPS#70
simpler 3-frame + 2-zoom scenes: https://playground.babylonjs.com/#XIC32I#17

The problem is somewhere in the setTimeout() routines - there are two that i’m unable to merge.
(simplified pg version links above)

I figured it out! Thanks.

ohhh coool, love to see this on a monday morning :slight_smile: simplifying the issue has often this side effect