I am attempting to add VR compatibility to my game, please could you help me figure out how to better control the multiple cameras in my scene regarding the head tracking and movement from VR devices?
I’m using Unity v2019.4, and not using the new VR Plugin system. In my XR Settings I have Virtual Reality Supported ticked and have the Oculus and OpenVR virtual reality SDKs.
I have three cameras in my scene, at the following Depth levels:
2 = Main Camera (Depth only) which shows everything except my sun and skybox
1 = A Sun Camera (Depth only) showing only my sun layer
0 = A Background Camera (SkyBox) showing my custom skybox
The reason I render the sun on a separate camera is to give the effect of a very distant object. The sun camera is sat close to the sun, but when I move in the scene the sun never gets any closer giving the illusion of it being far out there in space. This works great in non-VR, but in VR if I move my head forward or to the side, the sun camera also moves and so breaks the illusion of the distant sun.
I have tried playing around with settings and done a lot of searching, but I cannot figure out how to stop the "local" movement in my sun camera. Any ideas?