javascripthtmlthree.jswebxr

How to find when xr session starts three.js webxr


I want to toggle style property of my carousel catalogue when the ar session starts so I write this :

const session = renderer.xr.getSession();

session.addEventListener( 'start', function () {
                            slider.style.display = "block";

                        });

But it does'nt work , how to know when xr session starts ?


Solution

  • how to know when xr session starts ?

    It's best if you check the read-only property renderer.xr.isPresenting. When this property is true, you know a WebXR session is active.