I am developing for android using Unity 5.6 and Gvr 1.4. Here is the sequence of events.
When the scene starts, VR camera is on by default and rotation tracking is enabled. After a few seconds, a new character is spawned/enabled and the camera position is switched to the head of the new character and at this point, and my requirement is to disable rotation tracking.
Here’s what I have tried so far,
I accessed the Gvr head script at runtime and set it’s “track rotation” variable to false. The camera is attached to the new character’s head and tracking was disabled when running on the editor. But tracking was not disabled when testing on the phone(I’m guessing it’s unity’s tracking).
I attached the camera to an empty game object “CamObj”. I used CamObj to transform my camera to the head of the new character. To disable the tracking, I used the following code and attached the script to CamObj.
Hi paraveensg; I’m not 100% sure of your setup, but maybe I can help.
First off, if you are moving the vr camera around the scene yourself, it should be the child of another object and you should move that parent object (I think you’re probably already doing this). The positional tracking will override any position you set on the actual camera object, so this is the only way to achieve “automatic” movement for the player.
To disable VR tracking on a specific camera, use VRDevice.DisableAutoVRCameraTracking(camera, disabled). This means that you don’t get any of the built-in Unity automatic tracking - which I think is what you want. If you wanted positional tracking but not rotation (not sure why you might want that) you would have to set the cameras transform.position manually as you are doing in the code snippet above.
Indeed, I want the disable VR tracking on a specific camera. But unfortunately it is not available in Unity 5.6 and I cannot update to 2017 version yet due to maintain uniformity in the shared code. Is there something similar for 5.6?
Ah sorry - I didn’t realise that the function wasn’t available in 5.6.
I have noticed, however, that you should be setting the localPosition and localRotation on your camera - this should solve your problem using your existing code!