Webxr-buttons div moved or removed?

I was using this before the latest Needle WebXR changes to grab the WebXR buttons div and hide or show them, is it renamed?

  start() {
    this.mainContext = this.context;
    const div = this.context.domElement.shadowRoot!.querySelector(
    ) as HTMLElement;
    if (!div) {
      console.warn("Could not find webxr-buttons element");

Original Post on Discord

by user 103054507105067008

Hello there – we have an experimental AI bot :robot: that might be able to help you with your question. Would you like to try this out?

You can access it via the getButtonsContainer here for example: Discord

Or alternatively:
this.context.domElement.queryElement("needle-webxr-buttons")should also work (it’s a custom webcomponent now)

Sweet, investigating how to hide/show those send to quest and qr code buttons now as those are new, very cool to have the QR code one I’m using it a lot now rather than Chrome’s send QR code

by user 103054507105067008

You can just disable them in the WebXr component (there are options in unity)


At runtime is it possible now to enable or disable those buttons showing? I have a model viewer using url params to dictate if AR or VR buttons show etc

by user 103054507105067008

getButtonsContainer().arButton.style.display = "none" or remove()

My functionality for it already sort of works so I’m just checking what I need to add for the QR code one

by user 103054507105067008

Looks easy enough thank you

by user 103054507105067008

For this I get this.context.domElement.queryElement is not a function

by user 103054507105067008

sorry it’s querySelector

How do I get the QRbutton like this example for the sendToQuestButton? xr.getButtonsContainer().sendToQuestButton.style.display = "none";

by user 103054507105067008

There’s no such button built-in right now - but you can use the QR code function to generate the image (import via @needle-tools/engine)

            const size = 200;
            const code = await generateQRCode({
                text: window.location.href,
                width: size,
                height: size,
            qrCodeContainer.innerHTML = "";