Issue with Meta's "Immersive Web Emulator" extension

I have a recent issue reported and I would like to be able to fix it upstream (in react-babylonjs), but it doesn’t look like there are any hooks/observables available for me to automatically detect this emulator being activated in a session. Keep in mind that I am not creating the session myself (I have no access to XRSessionManager instance). When I say fix upstream then I need a way to detect this emulator and put in my own shim.

The issue is here:
{ whenVisibleOnly: true } breaks Meta’s “Immersive Web Emulator” extension · Issue #310 · react-babylonjs

I was thinking that if I could detect when an XR session was initiated (via an observable on scene/engine) then I could add my own enter/exit observables when detecting that specific emulator is being used. It would seem that Meta extension is doing something to the canvas to make it appear off screen (the feature reported to conflict uses an IntersectionObserver on the canvas to pause rendering).

I could potentially accomplish with scene onNewCameraAddedObservable, but I think it would be a hacky solution. Likely there is something more obvious that I am not aware of…


ping @RaananW


I have fixed many small issues and added 2 new observables in this PR, which was just merged - WebXR improvements by RaananW · Pull Request #14753 · BabylonJS/Babylon.js (

It also fixes an issue we had with the emulator, that caused a pointer event to fire with NaN values. There is no version currently supporting this, and as it was just merged it is also not yet available in the playground. Do those changes solve your issue?


Thanks @RaananW - I will let the issue creator know and see if that resolves it. Otherwise I will install the extension and dig in a bit more myself.

1 Like

Turns out to be a bug in the IntersectionObserver callback in react-babylonjs. The callback is an array of intersection events, while last item in the array is the one to use.

1 Like