WebXR properties of undefined error on enter

Hi there,

We recently started having problems with the web XR. Getting the following error when trying to enter XR:

TypeError: Cannot read properties of undefined (reading 'attachedToElement')

I can’t seem to reproduce this error in the playground, but it is consistently happening in our code. We are on version 5.15 of Babylon, I also tried this on the latest version (5.18) with the same result. Setting the Babylon version back to an older version, like 4.20, seems to resolve this specific issue.

We are using the functionality like this:

const xr = await this.scene.createDefaultXRExperienceAsync({floorMeshes: [this.scene.getMeshByName('zero-height-floor')]});
const session = await xr.baseExperience.enterXRAsync("immersive-vr", "local-floor")

Any advice would be greatly appreciated!

Kind regards,
Franco

Unfortunately @RaananW is in vacation at the moment until the end of this week so you might experience a bit of delays for the answer.

In the meantime, a repro would really help as I cannot see where this could happen in the code :frowning:

2 Likes

Hi @sebavan thanks for having a look.

We are still a bit stuck there, I will keep trying to reproduce this as well.

Appreciate the time :+1:

Ohhh I may have found it, will push a fix in a sec :slight_smile:

1 Like
2 Likes

Awesome thank you!