stalgiag/p5.xr

Immersive VR request not sent

Closed this issue · 5 comments

Nature of issue?

  • Found a bug
  • Existing feature enhancement
  • New feature request

Which area does this problem relate to?

  • VR
  • AR(ARCORE)
  • AR(MARKER)

Details about the bug:

  • p5.js version: 1.5.0
  • Device Name: - Meta Quest 3
  • Web browser and version: Meta Quest Browser version 31.4.0.5 ( Chromium version 120.0 )
  • Operating System: Quest Version 62.0.0
  • Steps to reproduce this:
WhatsApp.Video.2024-02-27.at.16.15.57.mp4

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.

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

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.

@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 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

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.