googlevr / cardboard

Open source Cardboard SDK and samples
Other
1.48k stars 253 forks source link

Access Rotation Component of Cardboard Viewer #287

Open zandoneill opened 3 years ago

zandoneill commented 3 years ago

Hi all!

I am having difficulty accessing the rotation of the head/cardboard viewer during my VR simulation. I think it is related to the tracked pose driver but I cannot figure out how to actually get the coordinates. Is there a solution to this that I'm just not seeing? Thank you.

Mandelbrow commented 3 years ago

Hi, What platform are you using? If its Unity the local, and global Euler angles should tell in which direction the camera is looking. Not sure when in the frame they are updated though. When for example the tracking is resetted in one frame, practically nothing happens with the localEulerAngles in the next frame. Thats not right. Haven't tried SDK v1.7.0 yet, perhaps it's fixed there.

jballoffet commented 3 years ago

@zandoneill, I suggest you to take a look at the Hello Cardboard sample scene. You'll notice that there's a game object called Main Camera (which is a children of the Player game object) which, as you pointed out, has a Tracked Pose Driver set. The Cardboard XR plugin feeds the head pose here, and it is automatically applied to the Camera via the Tracked Pose Driver.

About how to access the Main Camera programmatically, I suggest you take a look at this page in Unity docs.

In case this does not solve your issue, please reach out again to us, providing more details about the issue and if possible, a repro project and the steps required to reproduce it. Thanks!