ngokevin
ngokevin

Reputation: 13233

How do I stay in VR when linking between mobile WebVR sites in A-Frame?

I am linking between several WebVR experiences on a mobile WebVR site. When I use the cursor component or another component to navigate to another site, it loads the next site in mono mode (not VR).

How do I stay in VR for mobile?

Upvotes: 2

Views: 791

Answers (1)

ngokevin
ngokevin

Reputation: 13233

As we improve the link traversal story, this will become better out of the box for mobile. Note this answer is for mobile, desktop/true WebVR will have link traversal as part of the spec and will become part of A-Frame in the future as browser support rolls out.

But on mobile, you should be able to enter stereo mode without requiring user interaction. Though I forget whether on some devices we are using the fullscreen API so that might get in the way.

Here's a component to automatically persist VR:

AFRAME.registerComponent('auto-enter-vr', {
  init: function () {
    this.el.sceneEl.enterVR();
  }
});

Then you can use it like:

<a-scene auto-enter-vr>

Check out the href component to add links (e.g., change window.location on event such as cursor component click).

Upvotes: 2

Related Questions