I want to ask about how to make a GUI can follow the camera. For example, when the camera moves by x, the GUI will also move by camera.position.x + 2. I include a video to make my question clearer. Maybe someone can include documentation or playground. thanks.
Displays gui from oculus touch input according to initial camera position.
When I move and I try to display the gui, the gui position remains the same as the beginning.
I am always very grateful that you always reply to my questions. Next I will attach an example of my question and its playground. On my playground when when the Trigger button on the oculus quest controller is pressed, the GUI will appear.
So you are trying to achieve an HUD-Style GUI that will follow the camera wherever you go.
You could use a full-screen UI for that. This is our default GUI example with XR support and a bit of changes so that you will see it correctly in XR:
Awesome, exactly what I was hoping you will see. This just shows that full screen UI works - notice the color picker that keeps on following you. Now you need to build the GUI as you see fit
But when I use it directly on Oculus, the appearance is divided into 2 parts and it makes me dizzy unlike normal 3D environments. And also I can’t interact with the color picker who follows my camera. Is there a way to overcome this?
I made a new playground about the topic above, it looks like I will make it like this. So I will make a GUI where every camera moves, I can display the GUI in front of my camera’s latest position with the keyboard button or the button on the oculus touch. I managed to make it with input from my keyboard button (I did console log on the camera to find out the latest camera position). But I was not able to do it using my oculus touch. GUI position is always in the initial position of the camera. It is as if the camera has not moved position and the value of the camera position has not changed when I press the button on my oculus touch. I included videos and related playgrounds. Maybe you can teach me to overcome this. Thank you very much
Oh, this one is simple - you are referencing the wrong camera
The XR camera is not the camera you create in the createScene, but a camera created in the xr experience helper. When you are moving the xr camera, the original camera’s position stays the same. To overcome this, either use the camera in the experience helper’s baseExperience , or use scene.activeCamera, which will always be the currently used camera.
May I ask one more time? In the playground above, we can display the 3D GUI according to the camera position where gui.position = scene.active.camera.y - 1. So that the camera will always be on that axis even though the camera’s view is facing another axis. Is there a way for us to be able to display the GUI according to the viewpoint of the facing camera?
+1. I too get double vision in oculus quest 1 in immersive . I’m using the latest babylonjs preview version. Would love to get fullscreen GUI advanced texture support for immersive XR in Quest, as it seems to be the most simple way to add GUI menus that face and follow the camera all the time.