Is there an effecient way to clone a scene in a webworker ?
Or do I need to reload it in webworker ?
The webworker will do collide computations of a film in advance and will then be disconnected from the scene view representation.
There is no efficient way of doing this. If you only need to do this once I would suggest using
scene.toJSON() and use the
ObjectLoader in the worker to reconstruct the scene.
However, If you are using a custom loader for your scene and you can distinct collision meshes from your visual representation meshes, I would suggest using a single buffer geometry for collision detection and pass the pointer of the buffer object to the worker - this is simply a pointer in memory and won’t make a copy of the object, making it instantaneous. Check out the worker version of cannon js for some inspiration.