Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
brendenfrank's avatar
brendenfrank
Honored Guest
12 years ago

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!

3 Replies

Replies have been turned off for this discussion
  • 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.
  • 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.