geschirr
geschirr

Reputation: 51

Is it possible to navigate from one A-Frame scene to another without exiting VR mode on mobile?

I've got an A-Frame scene from which the user can navigate to multiple different sub-scenes. Once the user entered VR mode, he can navigate to these sub scenes. I use window.location.href for this. Unfortunately, when entering one of the sub-scenes, VR mode has to be initiated once more. I tried to automatically enter VR mode with enterVR(); but apparently this is by browser policy not allowed.

According to the documentation it's supposed to be possible if the browser implements the vrdisplayactivate event. BUT it's limited to Firefox desktop, Oculus Browser, Samsung Internet, and Supermedium.

In the end my A-Frame application should be primarily used on Android. My big question is whether it is at all possible to achieve hyperlink navigation within VR on mobile, or whether I should look for an alternative approach.

Any help is appreciated!

Upvotes: 1

Views: 430

Answers (2)

geschirr
geschirr

Reputation: 51

Since it doesn't seem possible by web standards, I found a workaround for my problem with the help of jQuery.

I defined an a-entity with nothing but an ID inside my main scene

<a-entity id="includedScene"></a-entity>

And instead of using window.location.href = 'xxx.html' I used jQuerys load function to replace the includedScene entity with whatever sub scene I want to load:

$("#includedScene").load('xxx.html');

Don't forget to include jQuery in the index.html

<script src="path/to/jquery-3.4.1.min.js"></script> 

Maybe this is helpful for someone.

Upvotes: 1

Diego Marcos
Diego Marcos

Reputation: 4585

No. Fullscreen mode doesn't persist on page navigation. It's a constraint of the Web standard

Upvotes: 1

Related Questions