Doing picking on a worker

Are there any out of the box solutions for doing picking on a web worker? I have a case where the rendering is nice and fast 60fps, but I often get 100-200ms of jank when moving the mouse over the parcel, which I’m pretty sure is due to the picking code going over the scene. I’ve got an experimental beta client that loads all the geometry in a webworker, then passes it back to the main thread to do the rendering, and that’s really buttery smooth, but I don’t want to reintroduce this jank by doing picking on the main thread. I’m going to try and implement it myself using my current beta client, but was just wondering if there was some magic (maybe using the offscreen canvas feature?) that would make this easier?

One pick shouldn’t introduce that much jank. Is the stuttering on click or as you move the mouse?

Hi guys! I’m curious if/not there is an ActionManager on this parcel and if/not ANY mouseEnter/Exit (mouseOver/Out, etc)… is active on the parcel. (thx)

I once saw a property named .useOctreeForPicking, too. I’m not sure what kind of fruit/nut is picked from an “octree”… but let’s make a pie and see how it tastes. :wink:

This is definitely a good idea! You just need to have a null engine running in a worker that you need to keep synchronized.

Other option could be to use the octree for picking:
https://doc.babylonjs.com/how_to/optimizing_your_scene_with_octrees#optimizing-collisions-and-picking