• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by Supershandy · Aug 22, 2015 at 02:29 PM · vrcamera rotategoogleunity4

Cardboard camera issues

Hi everyone,

I'm currently designing a rollercoaster type test app using google cardboard and i'm running into a small issue that I can't seem to find an answer to, basically I have a parent object follow a set of waypoints which works fine and I have the cardboard cameras set as a child of that object.

Now the head rotations work fine and the camera rotates as the parent rotates, but the cameras don't face the direction the parent is travelling in, the cameras always seem to be locked looking north, i.e the parent turns 90 degree to the left but the camera always stays at 0 degrees.

Is there a way to update the cardboard head to looking in the same direction as the parent object, say if the user turns their head slightly off to the right and the parent turns the corner that when the user moves their head back forward then the camera is at the same angle as the parent.

I've also tried the "target" variable on the CardboardHead script but that didn't work either.

Cheers

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dolims · Aug 31, 2015 at 03:59 AM 0
Share

When you say the camera rotates as the parent rotates, you mean only on certain axes?

avatar image meta-meta · Sep 22, 2015 at 03:13 PM 0
Share

I find when I point the "target" property to a GameObject the camera moves and rotates to match the target but it seems the camera axes get rotated. This target is not a parent and the only relation is through the "target" property.

Rotating the target on the y-axis by 90 degrees will cause the cameras to roll ins$$anonymous$$d of pitch when I nod my head up and down. Rotating on the y-axis by 180 degrees will cause the cameras to pitch in the opposite direction when I nod my head.

Are you experiencing anything like that?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by jonathanasdf_google · Sep 22, 2015 at 04:44 PM

In the v0.5.1 and earlier releases there's a silly bug that causes this when using the target property. It's a one-line fix, so you can try it out yourself (it'll be fixed in an upcoming release). In CardboardHead.cs, in the function UpdateHead(), change this:

 transform.rotation = rot * target.rotation;

to this:

 transform.rotation = target.rotation * rot;
Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image dolims · Sep 22, 2015 at 04:58 PM 0
Share

Ah heck. I manage the account name this answer was posted under, and forgot I was logged in with it when I wrote the above. That was me.

avatar image meta-meta · Sep 22, 2015 at 06:38 PM 0
Share

I swear I looked at that line a few days ago and wondered if the order was right but never got around to testing. quaternion multiplications are not commutative. thanks @dolims!

avatar image meta-meta · Sep 22, 2015 at 06:51 PM 0
Share

In the Cardboard SD$$anonymous$$ reference, I think the behavior of the target property could be better defined:

A target object may be specified to provide an alternate reference frame for the motion.

This was not enough for me to go on to determine whether my target object was acting as intended.

$$anonymous$$ay I suggest something to the effect of: Head tracking position and rotation will be relative to the position and rotation of the target object's transform.

As an example, my specific use case is within a 360 panorama viewer, the user should be able to rotate her virtual body to see what's behind her head. This would come in handy if I'm using the app in a situation where I can't physically turn all the way around like on a bus or airplane.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

28 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Google VR camera flipped 2 Answers

Framerate slowly drops when rendering world space canvas with Google VR on Android 0 Answers

Google Cardboard on iOS not working 2 Answers

Touchscreen to Keyboard 0 Answers

Google VR (Cardboard) don't work with Render Pipeline Asset. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges