Glitching GUI-Mesh in VR when parented to Camera?!

, ,

Dear BJS-Forum,

we are launching our VR-fair soon and I have a Problem regarding the glitching of a GUI-Mesh. Since this is our first VR-project, maybe someone can have a look and help us? :slight_smile: I can’t figure it out and it makes no sense to me whatsoever!

—> Der virtuelle Showroom der Forschungsfabrik Mikroelektronik Deutschland | FM3D (tested/developed on Quest 2)

When someone clicks on one of the exhibits, a mesh is shown with a GUI put ontop of it. This works great.
However, when someone walks into the lift another menu should be triggered on intersect. This works, the menu is triggered, however the menu is only shown, when the user looks downwards. When the user looks straight ahead, the menu disappears/ glitches out of existence…

How can this be? Both menus are constructed the same way:

var faceUV = new Array(6);
for (var i = 0; i < 6; i++) {
    faceUV[i] = new BABYLON.Vector4(0, 0, 0, 0);
}
faceUV[1] = new BABYLON.Vector4(0, 0, 1, 1);

this.vr.menu.mesh               = BABYLON.MeshBuilder.CreateBox("vr_menu_clicker", {
    height:.55, 
    width: .8, 
    depth: .0001, 
    faceUV: faceUV
}, this.scene); 

this.vr.menu.mesh.isPickable    = true;
this.vr.menu.mesh.isActive      = true;

this.vr.menu.tn                 = new BABYLON.TransformNode("vr_menu_tn");
this.vr.menu.mesh.position.z    = -.5;
this.vr.menu.tn.parent          = this.camera;
this.vr.menu.mesh.parent        = this.vr.menu.tn;
this.vr.menu.mesh.rotation      = new BABYLON.Vector3(0,Math.PI,0);

this.vr.menu.mesh.setEnabled(false);

The menu is then shown via:

var na = this.camera.absoluteRotation.clone().toEulerAngles();                    
this.vr.menu.tn.rotation.y       = na.y - Math.PI;
this.vr.menu.mesh.setEnabled(true);

I’m sorry, that I can’t offer a playground :confused:

Steps to reproduce:

Has someone experienced something similar and can maybe point me in the right direction. Can someone with a VR-Goggle who is more competent than me maybe have a look? :slight_smile:

The inspector can be triggered by hitting the tab key.

Thanks a lot!

Can’t you provide a pared down example on a Playground?

1 Like

A playground would really be wonderful, but maybe you can try this - make the mesh always active (alwaysSelectAsActiveMesh) and see if it works. It might have been the transformation applied makes it leave the frustum for some reason.

Dear @RaananW,
i tried setting the mesh to alwaysSelectAsActiveMesh - sadly it didn’t work though… :confused:

I think it must have something to do with VR-mode. When moving the player into the elevator in a regular browser, the menu is triggered and visible (even though it is way to close to the player / to big and twisted around the z-axis for 180 degrees…?)

The regular menu and the lift-menu are created in the same way. The regular menu is working, the other isn’t. So i think it might have to do with some other feature in the VR-world…?
I tried modifiing .fov and .minZ. it didn’t got me the expected results either… Any other ideas? Please? :slight_smile:

In the elevator the player is standing within an other mesh, which is used as an onintersect-trigger-mesh. Cloud it have something to do with this?

Thanks :slight_smile:

I tried going in the elevator (on desktop first). Is this expected?

Yes it is:)
But for some reason in VR with Quest 2 the menu is only shown when one looks towards the floor…