Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 silverxah · Jul 21, 2016 at 10:08 AM · rotationnot workinggyroscopecalculate

Gyro Rotation Offest Calculation or Alternate Solution?

So I have a script where I use the gyroscope data of an iPhone to turn a camera. As of right now, my script matches the camera's rotation with a Vector3 with altered axes, and for vertical and horizontal movements from the initialized position (phone is flat with screen pointing up), the script works fine, i.e. I turn the phone left and the camera turns left, I turn it right and the camera turns right. However, a problem i'm having is that if I turn the phone 90 degrees left/right, and then turn it 90 degrees up/down, the camera barrel rolls instead of moving up/down. If anyone knows the mathematical formula for fixing this issue, or just has a better solution, please let me know. Thanks.

Comment
Add comment · Show 1
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 silverxah · Jul 25, 2016 at 06:37 PM 0
Share

http://forum.unity3d.com/threads/gyroscope-quaternion-to-unity-camera-help-please.75288/ Basically having the same problem as this guy,

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Dave29483 · Jul 22, 2016 at 07:02 AM

You may find it easier if you have a parent object which handles panning and then apply tilt to the camera child object. Just make sure you zero out the other two unused rotation axes on each object.

e.g. parentRotation Vector3(0, pan, 0)

childRotation Vector3(tilt, 0, 0)

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 silverxah · Jul 22, 2016 at 06:16 PM 0
Share

Would I create an empty GameObject for the parent?

avatar image Dave29483 silverxah · Jul 22, 2016 at 07:07 PM 0
Share

Yes, you would create an empty parent object :)

avatar image silverxah Dave29483 · Jul 25, 2016 at 06:47 PM 0
Share

But this script makes it so that the camera will continually rotate if the phone is held at an angle right? I want the camera to match the angle of the phone, ie if the phone is pointing up, the camera points up.

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.

Follow this Question

Answers Answers and Comments

74 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 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 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

Vuforia ARCamera doesn't rotate 1 Answer

Problems with gyro camera rotation. 0 Answers

Inaccurate rotations with android phone gyroscope 0 Answers

How do I use both touch and gyro to transform rotate the camera? 3 Answers

How do I control the rotation of object. 1 Answer


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