I’m using google cardboard with Unity 5.6 and I would like to freeze camera in two directions. If I attach some script to camera where is in update method reseting camera rotation to zero, nothing happens. SDK probably overrides this behavior.
I tried attach camera to some empty parent but still no sucess.
Unity applies the updates from the HMD later than lateUpdate() so no matter how you modify the VR camera’s transform it will be ignored.
You can apply the opposite rotation via a parent, but in general why do want to do this? It’s going make most users very motion sick. Position I could see but rotation except in very specific instances like teleporting or other things is going to make people sick since it sounds like you want to do this every frame.
Maybe my whole idea is wrong. Let me explain what I need to do. I want to create “2D game” in VR. Imagine something where whole scene is still before your eyes and all you’re doing is using head up or down to move one object.
First I tried attach whole scene under camera object but game is going little bit slow when I rotate head around. So my next idea was freeze camera but that’s impossible.
I think the best solution would be if I create non-VR 3D game with access to gyroscope (or accelerometer) API and own two “VR-rendering-style” cameras. API will be probably easy but I don’t know how to do second problem.
Your first attempt would likely be the easiest. I would think it was getting slow due to the sheer number of things that were moving (I assume there were alot). It would get especially slow if you were also moving anything marked static (lights, colliders, etc.) because they essentially aren’t static anymore. You might want to try again with unchecking static from anything.
For your second attempt you’d have to apply the opposite rotation to the parent of the camera. So if you look 90 degrees right, you’d have to rotate the parent 90 degrees left to counteract the HMD. If you do this things shouldn’t slow down when you move but you might notice a bit of jitter but you won’t know until you try.
I can definitely say that for myself though if I’m in a 3D VR scene and I tilted my head to the right but the imagery didn’t move I would get a headache pretty quickly. Every brain is different but there is going to be a significant chunk of people that will not feel well in a scene like that.