How to change scene in VR using gaze only?

Hey, need some help with scene change in VR for cardboard using gaze interaction without any controller.

What have you tried so far? The standard practise is to let the user look at the button/object for X secs to do an action. (The VR Starter Kit does something like this to change the boxā€™s material)

Hey @yaustar thanks for reverting so swiftly.
Iā€™m newbie to PlayCanvas and WebVR as well. I have build a simple scene taking reference from VR Starter Kit. But for interacting we need to click on the buttons, suppose we have to rotate the Box right we have to look the right button and then click on it to interact. I want to interact it without clicking it

Iā€™m trying to build a simple interaction for Google Cardboard (0Dof), when we look at a object with ā€˜Recticuleā€™ it should interact and change the scene.
For instance, there are 2 Scenes ā€˜Aā€™ and ā€˜Bā€™, If a person in Scene A looks at a certain object he should teleport to scene B or any other scene which we define.

With the Starter kit, you can see how you have to stay looking at a box before it changes to an orange material? Thatā€™s how you would ā€˜clickā€™ on a button with gaze only.

In your case, you want to change scene instead of changing colour.

Just be wary that the camera in the current scene is being used for the VR view and changing scene by destroying the entirety (as shown in the tutorials) of the current scene may cause issues. You may have look at using a base scene that has the VR camera setup and then load the scene additively under another graph node.

You can use a timer in conjunction with a raycasting or timer in conjunction with a infinite ray and bounding box, for example. This will allow you to define objects without pressing and to perform any actions under certain conditions. Iā€™m currently working on something similarā€¦ https://playcanv.as/b/1oHCLT03/

Please correct me if iā€™m wrong, this is the VR Starter Kit tutorial i guess https://playcanv.as/p/TAYVQgU2/ . If this is it, then it is not clicking/interacting by looking.

Regarding your changing scene statement, I didnā€™t get it totally it would be really nice if you can upload a video demonstrating that or any ScreenShot that would be really nice. I believe this will aid lot of folk out there who are trying to build Simple Cardboard webVR experience. This is my scene hope it will give you some ideaā€¦ https://playcanv.as/b/zKo9Lc4t/

When you create a new project, there is a WebVR template that you can use. Itā€™s forked off https://playcanvas.com/project/435780/overview/starter-kit-vr

1 Like

Awesome!! Thanks @yaustar Youā€™re a life saver.

Now Just explain me regarding changing scenes process. How can we load another scene under another graph node ??

To load another scene under another graph node, you just need to delete the graph nodes you want to delete when loading a new scene.

You simply have to modify the load-scene-helper.js in the sample project provided by PlayCanvas:
https://playcanvas.com/project/924351/overview/switch-full-scene-example

In the middle of the script you can find the following:

// Destroy all the entities on the app.root to completely remove 
                // the existing scenes
                var rootChildren = app.root.children;                                                
                while(rootChildren.length > 0) {
                    rootChildren[0].destroy();
                }

In my case, I destroy the graph node called ā€œWorldā€ since I have put all the scene-specific elements under that node.

In the first scene, I also have another root level graph node called ā€œVR_Rigā€ where I have placed elements like the camera, the controllers etcā€¦That ā€œVR_Rigā€ graph node never gets Destroyed so it remains constant across Scenes.

Hereā€™s the example of code in my case:

var rootChildren = app.root.children; 
for(let i = 0; i < rootChildren.length; i++){
    var rootWorld = rootChildren[i].findByName("World");
    if (rootWorld != null){
        rootWorld.destroy();
    }
}
1 Like