- Home /
Android Cardboard - Fake UI Overlay
I know that we can't add Screen Space GUI to Cardboard VR games, so I've created a Quad, set its material to an Unlit material and set my UI sprite as its texture. Then, I make the Camera to be the parent of the Quad and reduced their distance to a very low value. So whenever the camera moves or rotates, the Quad (acting as a UI Overlay) moves too (The Quad is at center of the screen). I want the size of the Quad to be 5% of the height of the screen and its width to be equal to the height. But, as you know, the FOVs of different Cardboard Viewers are different, so the Quad may appear bigger or smaller on different viewers. So my purpose is to get the FOV of the viewer and then calculate the scale of the Quad.
OK, we need to do all these:
Get the FOV of the Cardboard Viewer
Get the size of the viewport, not the screen (it's VR, so there are two viewports but the size of them are equal and we want to get that)
Calculate the proper scale for the Quad (based on the FOV and the size of the viewport) to be always 5% of screen height (and width = height)
How can I do that?