- Home /
Force rotate XRRig camera?
Is it possible to somehow change XRRig camera's localRotation?
I need to rotate XRRig when player rotates camera with head. Just typing
transform.localRotation = Quaternion.identity;
not works.
I think it is due to physical movement of head camera. I want to smoothly turn player by y axis as camera rotates
Thanks.
Answer by rh_galaxy · Nov 01, 2021 at 02:54 PM
You need to put the XRRig in a container object, which you can rotate around Y. You cannot and should not try to modify the rotation of the XRRig, since it is meant to show where you are moving/pointing your head. You can also reset the view from the headsets menu, but that's another thing.
On later Unity versions you don't need an XRRig just a camera with a TrackedPoseDriver, and put that in a container.
Thanks for answer. This my setup, device base XR-Rig from XR Interaction Tookit. Can I do something with that setup?
/storage/temp/188157-screenshot-21.png
I haven't tried XRRig myself.
Maybe you can rotate "Camera Offset" transform. Or create a container at the root level that I suggested and put XRRig there. The camera will follow, but I have no idea if it breaks something else...
Your answer