# WebXR tutorial very confusing and incorrect

**URL:** https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774
**Category:** Bugs
**Created:** [August 29, 2020, 5:20pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774 "2020-08-29T17:20:45Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [August 29, 2020, 5:20pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/1 "2020-08-29T17:20:45Z")

</div>

[The WebXR Experience Helpers - Babylon.js Documentation](https://doc.babylonjs.com/how_to/webxr_experience_helpers#the-webxr-default-experience-helper) This section doesn’t match the api docs.

```auto
scene.createDefaultXRExperienceAsync

```

does not create an WebXRExperienceHelper, it creates a WebXRDefaultExperience, whose `baseExperience` is a WebXRExperienceHelper.

In the next line, `WebXRDefaultExperienceHelper` doesn’t exist.

I’m sure there’s more to it, but I’m learning myself.

---

<div class="post-metadata">

### Author: ![Deltakosh](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/deltakosh/32/26635_2.png) [@Deltakosh](https://forum.babylonjs.com/u/Deltakosh)
#### Post date: [August 31, 2020, 2:58pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/2 "2020-08-31T14:58:29Z")

</div>

pinging @RaananW

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [August 31, 2020, 3:03pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/3 "2020-08-31T15:03:05Z")

</div>

Hi,

I assume you are referring to this:

![image](https://us1.discourse-cdn.com/flex024/uploads/babylonjs/original/2X/0/0e8742327d8c55968eda1a249eeb52f19808ef1e.png)

the list describes what the default experience does under the hood. And it does initialize a base experience helper, amond other things (as you also found out yourself). It does also state that:

> `To check if the default experience helper initialized correctly, make sure the baseExperience variable was created:`

I can change the text thou if you find it confusing

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [August 31, 2020, 3:36pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/4 "2020-08-31T15:36:27Z")

</div>

In this line:

```auto
var xrHelper = await scene.createDefaultXRExperienceAsync( /* optional configuration options */ );

```

What I’m saying is that in this example, the variable is being named ‘xrHelper’, but [scene.createDefaultXRExperienceAsync](https://doc.babylonjs.com/api/classes/babylon.scene#createdefaultxrexperienceasync) returns a [WebXRDefaultExperience](https://doc.babylonjs.com/api/classes/babylon.webxrdefaultexperience), it’s not actually an ‘xrHelper’

In the next line

```auto
var xrHelper = await WebXRDefaultExperienceHelper.CreateAsync(scene, /* optional configuration options */ )

```

It says it’s equivalent, but first of all, there is no WebXRDefaultExperienceHelper class. Assuming it meant [WebXRExperienceHelper.CreateAsync](https://doc.babylonjs.com/api/classes/babylon.webxrexperiencehelper#createasync), it’s still not actually equivalent because it returns a [WebXRExperienceHelper](https://doc.babylonjs.com/api/classes/babylon.webxrexperiencehelper) and not a WebXRDefaultExperience.

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [August 31, 2020, 3:40pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/5 "2020-08-31T15:40:27Z")

</div>

And yeah, that line after that is also confusing, because “default experience helper” is not a thing. I guess it might just be an ambiguous phrase, because if it said “default experience’s helper” it would be easy to follow that there is a default experience which has a helper field.

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 2:27pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/6 "2020-09-01T14:27:23Z")

</div>

I am not sure I follow…

> [@BoldBigflank](#):
>
> first of all, there is no WebXRDefaultExperienceHelper class

Of course there is - [https://github.com/BabylonJS/Babylon.js/blob/master/src/XR/webXRDefaultExperience.ts#L66](https://github.com/BabylonJS/Babylon.js/blob/master/src/XR/webXRDefaultExperience.ts#L66)

It is the main entry to XR (well, the default one), and is the one returned when you use either one of those functions that you mentioned.

Internally, it has an instance of the webxr experience helper. it adds a few other important features on top (pointer selection, teleportation, ui and more).

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [September 1, 2020, 3:23pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/7 "2020-09-01T15:23:13Z")

</div>

WebXRDefaultExperience is what you linked.  
WebXRDefaultExperienceHelper is what the code says.

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 3:24pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/8 "2020-09-01T15:24:21Z")

</div>

Got it, but once you remove the helper (will be done), it all makes sense :-).

I will make sure to update the page

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 3:28pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/9 "2020-09-01T15:28:07Z")

</div>

I hope this makes more sense - [Update WebXR\_Experience\_Helpers.md by RaananW · Pull Request #2027 · BabylonJS/Documentation · GitHub](https://github.com/BabylonJS/Documentation/pull/2027)

(And thanks a lot for reporting this!!)

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [September 1, 2020, 3:28pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/10 "2020-09-01T15:28:53Z")

</div>

To make the “equivalent” functions actually equivalent they would need to look like this:

```auto
var xrDefault = await scene.createDefaultXRExperienceAsync( /* optional configuration options */ );
var xrHelper = xrDefault.baseExperience

```

and

```auto
var xrHelper = await WebXRDefaultExperience.CreateAsync(scene, /* optional configuration options */ )

```

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 3:37pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/11 "2020-09-01T15:37:37Z")

</div>

The default experience is actually a helper as well 🙂 Due to historical reasons and backwards compatibility its name has not been changed, but all in all - it is a helper. This is why the documentation was written this way.

~~I have no problem changing the variable name in the doc~~ I changed the variable name in the documentation (thanks for that) , but eventually - it is the developer’s decision what they name their vars and other members. The important part is understanding the API and the structure. And I do hope this part was clear.

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [September 1, 2020, 3:57pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/12 "2020-09-01T15:57:56Z")

</div>

Ok, so it looks like my problem with the API docs is that CreateAsync in [WebXRExperienceHelper - Babylon.js Documentation](https://doc.babylonjs.com/api/classes/babylon.webxrexperiencehelper#createasync) says it returns a WebXRExperienceHelper, but it actually returns a WebXRDefaultExperience.

Here’s a playground  
[https://playground.babylonjs.com/#YD34Q1](https://playground.babylonjs.com/#YD34Q1)

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 4:05pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/13 "2020-09-01T16:05:46Z")

</div>

The CreateAsync of the Default Experience returns default experience (as in your playground). The Experience helper’s CreateAsync returns a basic experience helper:

(the last helper is the one you are looking for):

[https://playground.babylonjs.com/#YD34Q1#1](https://playground.babylonjs.com/#YD34Q1#1)

If it says otherwise in the doc I will change it instantly, but I can’t find that in the docs

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [September 1, 2020, 4:16pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/14 "2020-09-01T16:16:35Z")

</div>

Ok cool, I see there’s another class that snuck in there. Last nitpick, the new code doesn’t work in a copy/paste sense because the `WebXRExperienceHelper` doesn’t have the `BABYLON.` prefix. Unless you already have some preference on that, it would help the newbies coming upon this article.

---

<div class="post-metadata">

### Author: ![RaananW](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/raananw/32/28955_2.png) [@RaananW](https://forum.babylonjs.com/u/RaananW)
#### Post date: [September 1, 2020, 4:44pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/15 "2020-09-01T16:44:37Z")

</div>

Yeah, this is a decision we have to make when writing the documentation - do we always use the Babylon namespace, or just use the classes. People using imports / es66 will argue that they can’t copy-paste too because of the babylon namespace.

We always provide playground examples with the code so you don’t need to work hard to see an example. this is a trade-off between providing a 100% working code (in the playground) to providing a clean code that can be used by all.

---

<div class="post-metadata">

### Author: ![BoldBigflank](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/boldbigflank/32/4426_2.png) [@BoldBigflank](https://forum.babylonjs.com/u/BoldBigflank)
#### Post date: [September 1, 2020, 5:23pm UTC](https://forum.babylonjs.com/t/webxr-tutorial-very-confusing-and-incorrect/13774/16 "2020-09-01T17:23:15Z")

</div>

Anyway, thanks for updating this. After the references to any ‘default’ were taken out of the helper section, it all clicked for me.
