GUI in Vr Mode can't be click
my button can’t be clicked in vr mode

Seems like there are no actions to the buttons. Am I missing something?

This is a part of my code,In htc focus’s firefox reality browser,if i click the button,i can see the buton in pressed state in normal mode,but in vr mode,i click the button and it never into pressed i create this demo ,it’s button are the same as my project(i open it in htc focus )

That might help (if you dont use the default experience):


I dont have a VR headset, so I can’t test ATM, sorry

Sorry! Seems like this will be the best way (found in the documentation):

This will, according to docs, Enable pointer selection from the XR controller (For clicking on buttons or gui elements). I guess enabling interactions will also do the trick. If not, do try using webXR (which is a bit more future proof than WebVR)

1 Like

var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(“UI”);
var gd = new BABYLON.GUI.Grid();
var sendBtn = BABYLON.GUI.Button.CreateSimpleButton(“sendBtn”, “send”);
This code,button can’t be click in Vr mode ,

var advancedTexture = BABYLON.GUI.AdvancedDynamicTexture.CreateFullscreenUI(“UI”);
var sendBtn = BABYLON.GUI.Button.CreateSimpleButton(“sendBtn”, “send”);
advancedTexture .addControl(sendBtn,0,1);
This code,button can be click,
I think Grid Intercept the onPointerClickObservable so i can’t click the button

Is it working natively? Because then it’s rather odd. the same events are being triggered when you click the mouse or your VR controller. Might be a z index issue. Could you share a playground with the scene working native but not in VR?

1 Like

In Vr mode ,My Controller’s Ray accross the gui,the end of Ray is not in the gui so my click is unuseful.

Will check that and let you know you can use this demo to test

I find this answer from forum,CreateFullscreenUI is not supported for webVR ,but AdvancedDynamicTexture.CreateForMesh can’t fix the gui in scene.


Trevor is wiser :grin:

Does this work now?

No,Use CreateFullscreenUI can make my UI as 2D UI in fixed position,when i move camera,the UI can’t be move,This is the effect I want,Use CreateForMesh,I can click the UI in vr mode,but UI will be move by camera…

That’s a matter of ux, but as Trevor said - it’s not supported in VR. You could use the forMesh in a static mesh, that should achieve the same effect, no?

thank you for your answer,but i don’t know static mesh’s mean.I try so many times but can’t achieve CreateFullscreenUI‘s effect

That would be a very quick implementation of CreateForMesh with a static mesh (a mesh that doesn’t move). Of course, you can attach the mesh to the camera to get the effect of “moving UI”, by setting the mesh’s parent to be the camera