No timeToTeleport in WebXRDefaultExperienceOptions from Typescript

I am taking JS code from a previous project and re-coding it into Typescript for another I am starting.

In the JS of the previous, the code was:

const options = {
    // when both AR & VR capable; AR wins for now
    uiOptions: {sessionMode: isARCapable ? "immersive-ar" : "immersive-vr"},
    useMultiview: true, // just guessing
    timeToTeleport: 3500
};
BABYLON.WebXRDefaultExperience.CreateAsync(scene, options).then((defaultExperience) => { ... });

That in Typescript fails to compile in CreateAsync() with sessionMode cannot be text. Ok, so I wrote it this way to get around it:

const options = new BABYLON.WebXRDefaultExperienceOptions();
// when both AR & VR capable;  AR wins for now
options.uiOptions.sessionMode = isARCapable ? "immersive-ar" : "immersive-vr";
options.timeToTeleport = 3500; // this does not compile
               
BABYLON.WebXRDefaultExperience.CreateAsync(scene, options).then((defaultExperience) => { ... });

A whole bunch of other properties are listed in the editor code completion dropdown, but not timeToTeleport. Please advise.

Hi JCPalmer,

I don’t timeToTeleport is part of the default experience options; it might have been before, but in that case I guess it moved. I believe that setting is specific to the teleportation feature, so it moved to the options for that.

IWebXRTeleportationOptions | Babylon.js Documentation (babylonjs.com)

2 Likes

Yeah it must have moved there. This validate my move to Typescript where checking is done. I usually write things the first time in javascript. The 2ND time, refractor / improve / Move to Typescript.

1 Like