WebXR camera in mutiple scenes

Hi folks,

We are doing a project that has two XR environments, and we want users are able to switch between them. I found the switch scene demo and I really like the idea to have separate scenes and render loop. But it seems WebXR only allows one camera so I can’t really create a second WebXR camera for the second scene? Is there a way to just use one WebXR camera and switch the attachment to the scenes? or any suggestion towards this scenario is highly appreciated.

Adding our XR Guru @RaananW

Great question! I was waiting to answer that one :slight_smile:

XR’s session manager requires a scene in its constructor, which is required to generate the resources needed to start an XR scene. This is a limitation in Babylon’s engine as well (as the render target texture used to render the scene is also scene-dependent). Apart from that there are the assets for the controllers, hands (if enabled), that are all scene-dependent.
We had a discussion once about multi-scene support, but I never dug into it too much. I will be happy to spend some time and see if we can separate XR and the current scene, but that won’t happen in the near future. Until then I would recommend using methods like the assets container to manipulate a single scene with different asset-groups to simulate multiple scenes

1 Like

Thanks for the reply! Good to know it’s on the future plan. Great advice for the assets container idea and we will give a shot for that

2 Likes