Async clone and merge meshes

Hi, I have a large number of meshes that I want to clone and merge together. I have tried both sps and the usual for loop mesh.clone + mergemeshes method. However, in both cases, the operation causes a ‘blip’ on the running operations on screen. Is there a way I could have the mesh cloning and merging done asynchronously w/o blocking my main loop within bjs ?

Welcome in the fantastic world of JavaScript :wink: There is only one thread

So no, there is no way. You need to split the work into small chunks

1 Like

okie, thks.

Put clone and merge logic into a worker;

  • Using the NullEngine
  • Post JSON.stringify(mergedmesh) to main.

In the main thread,

Done. :grin:

2 Likes