Issues after exiting WebXR: ActionManager, Virtual Joystick, and GUI stop working

Hello everyone,

Edit: Here is a Playground to demonstrate my issue: https://playground.babylonjs.com/#RWCM5J#2

I’m working on a virtual room. I use multiple cameras (FreeCamera, ArcRotateCamera, DeviceOrientationCamera) and clickable 3D objects via a custom ClickObject class using ActionManager. I also have a virtual joystick system for touch devices.

Everything works fine as long as XR is not used. I recently integrated WebXR using createDefaultXRExperienceAsync(). Entering XR works correctly. Exiting XR also seems to work, the camera switches back to the previous FreeCamera, and basic controls work partially.

Problem:
After exiting XR, all clickable objects (ActionManager), the virtual joystick, and GUI elements are visible but no longer interactive. Objects don’t respond to clicks, glow effects don’t work, and the joystick behaves erratically.

I suspect this is due to Babylon internally modifying the scene for XR or reinitializing input systems, which breaks my existing handlers/ActionManagers.

My questions:

  1. What exactly happens in Babylon.js when switching in and out of XR regarding cameras, ActionManager, and pointer events?

  2. Is there an official method or best practice to restore interactive objects, GUI, and virtual joystick after exiting XR?

  3. Do I need to rebuild the entire scene, or is there a way to “reconnect” existing ActionManagers and pointer events?

Any tips, examples, or references to Babylon.js functions for this scenario would be greatly appreciated.

Thank you!

cc @docEdub

1 Like

Ya I can repro this with that playground, thanks! I’ll see what I can find out…

1 Like

PR 17423 fixes it.

1 Like

Great! :+1: