Rotate object instead of camera

Hi everyone,

using the integrated Oculus Controller (Unity V5.1.2) I’m currently working on a camerasetup which looks like this:

BaseObject
      +-> ObjectToRotate
                       -> MainCamera
      +-> OtherObject
      +-> YetAnotherObject

Working with the Oculus, I want the MainCamera stay fixed in relation to the “ObjectToRotate” and use the HMD rotation to update the rotation of the “ObjectToRotate”.

Basically, this would mean that I have to null out the rotation of the MainCamera (which is done via the Oculus) and apply it to “ObjectToRotate”.

Has anyone done this? From what I see it seems that the Oculus Rotation is tilted by 90°.

How can I stop the Oculus VR controller to influence the camera and use i.e. the GetLocalRotation to adjust the objects rotation?

I have a base player object to control the movement of the player and attach the Oculus to that.

Not sure if this is what you are looking for, but it allows me to rotate the player and the Oculus camera rotates with it.

Unfortunately, that’s not really what I want.

Imagine an object. On top of that object is the camera. When you tilt your head upwards or downwards, it’s not the camera that is tilted but the object underneath it. I want the camera not to rotate itself.

If I understand the internal camera correctly, this kind of setup is not possible with the current system.

Oh! You could just set the child object transformation.rotation to the same value as the OVRCameraRig rotation.

public void Update() {
    targetGameObject.transform.rotation = cameraRig.transform.rotation;
}