Skip to main content
Up and Coming
August 4, 2013

Get current OVR camera rotation

Hey guys,

I'm trying to get the current facing rotation of the OVRCamera and it appears to be eluding me.

The OVRCameraController appears to store no information and the rotation appears to be handled individually on CameraLeft and CameraRight.

I have tried manually pulling the rotation from one of the two cameras and always appears to be off. So my question is:

How would one get the facing rotation of the OVRCameraController in real time?

Thanks!
    This topic has been closed for replies.

    3 replies

    Up and Coming
    August 4, 2013
    The right camera rotation should return the correct rotation although I had trouble doing it too. I wanted to put a crosshair in the direction I look. I ended up putting an empty object as a child of the right camera with some z offset and cast a ray from the camera to its child. Obviously not the right way to do it, but using camera.forward wasn't working for me.
    Up and Coming
    August 4, 2013
    Just read where the Proton Pulse guy did a similar thing https://developer.oculusvr.com/forums/viewtopic.php?f=30&t=3296 except he put the child object into the left camera.
    Up and Coming
    August 4, 2013
    So just to update you guys, I think I found a fairly simple solution:

    The 'Tracker Rotates Y' checkbox will update the rotation of the OVRCameraController Gameobject so all you need to do is grab its rotation. -That said, this is only if you want the Y, which I do.

    The 'gotcha' with this is that it doesn't work properly if it's a child of another game object. So if you have a character controller, you can't just make it the child of that object and will need to have them both in root while updating the position of the OVR camera to match your character controller position.