I took a look at the existing code in pointer-events-capture-behavior.ts. It seems that after setting _scene for the first time, it cannot be changed.
const startCaptureOnEnter = (scene: Scene) => {
...
if (captureOnEnterCount === 0) {
document.addEventListener("pointermove", onPointerMove);
// If there is _scene, it cannot be changed.
_scene = _scene ?? scene;
....
}
captureOnEnterCount++;
};
If the mesh is not in _scene,the event cannot be captured
const onPointerMove = (evt: PointerEvent) => {
...
// If the mesh is not in _scene, it cannot be picked.
const pickResult = _scene.pick(pointerScreenX, pointerScreenY, (mesh) => {
...
});
...
};
Yes. We'll have to have a way to get notified when the scene is destroyed and clear the scene so it will get reset on the next call. I'll have to look and see if there is an observable we can use.
I took a look at the existing code in pointer-events-capture-behavior.ts. It seems that after setting _scene for the first time, it cannot be changed.
If the mesh is not in _scene,the event cannot be captured