stalgiag / p5.xr

a library that helps turn p5.js sketches into immersive experiences using WebXR
GNU Lesser General Public License v2.1
117 stars 25 forks source link

Immersive VR request not sent #203

Closed TiborUdvari closed 4 months ago

TiborUdvari commented 4 months ago

Nature of issue?

Which area does this problem relate to?

Details about the bug:

https://github.com/stalgiag/p5.xr/assets/1434442/cea29993-128b-4c2e-ac17-5402ce9878ec

The immersive-vr request session is never being called, because this.hasImmersive is never set.

if (this.hasImmersive) {
  console.log('Requesting session with mode: immersive-vr');
  this.isImmersive = true;
  this.resetXR();
  navigator.xr
    .requestSession('immersive-vr')
    .then(this.__startSketch.bind(this));
} else {
  this.xrButton.hide();
}

I think it should be updated in __sessionCheck() like this:

const supported = await navigator.xr.isSessionSupported(session);
this.hasImmersive = supported; 
this.xrButton.setAvailable(supported, mode);

I can submit a PR, if you think this is the correct way to handle it.

JuanIrache commented 3 months ago

Has this been merged to the CDN version used in the public examples? I cannot get them running in a Quest 3, whereas other general Webxr examples seem to run well.

Thanks

stalgiag commented 3 months ago

Has this been merged to the CDN version used in the public examples? I cannot get them running in a Quest 3, whereas other general Webxr examples seem to run well.

Thanks

Hi! The NPM package has been updated. I am not sure how long it will take the CDN to update the cached library but this fix has been pushed.

TiborUdvari commented 3 months ago

@JuanIrache there was also a problem with the texture in this example for some reason, could you try out the example here? https://editor.p5js.org/TiborUdvari/sketches/fgA0L9jQ6

JuanIrache commented 3 months ago

@JuanIrache there was also a problem with the texture in this example for some reason, could you try out the example here? https://editor.p5js.org/TiborUdvari/sketches/fgA0L9jQ6

It loads, but the entire room is upside down. I'm not sure if that's intentional

TiborUdvari commented 3 months ago

There was a rotate(PI); in the code, I removed it now, I'm not sure why it was in the original example. It should be okay now.