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 /
avatar image
1
Question by Talimar · Aug 23, 2011 at 11:26 PM · androidrotationaxis

Converting Android Axis to Unity Axis

I'm receiving input from SensorManager.getRotationMatrix() and trying to apply this to my Unity camera while the device is in Landscape mode held out in front (with the screen pointing at me), so that when I hold it like this, I will be looking along the z axis in Unity

The problem is the Android axis is x:right, y:forward, z:up. Unit is x:right, y:up, z:forward

sounds simple, but if you remap the device axis so x is up (it faces up when in landscape mode), then y is left and z is backward. You can remap the x and y axis only, so remappng x as AXIS_MINUS_Y and y as AXIS_X only gets you so far, z is still pointing backwards.

Android only gives you a rotation matrix, which I convert to a Matrix4x4 and then use Quaternion.LookRotation(). I did find a method that converts a matrix to a quaternion, but that gave the same result.

I have had moderate success, the best was when I got pitch matching (rotating the device around its local y axis translating to rotation around the unity x axis), but the other two rotations were reversed (yawing around the device x axis (which is currently point up) resulted in roll in unity, and rolling the device around its z axis resulted in yaw in unity).

I am not good at this kind of thing, I'd really appreciate some help.

Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

Unity touchpad not working to rotate an object 1 Answer

Change rotation axis when importing from Maya 2 Answers

2D : Rotation of Object With x-y Axis 2 Answers

A node in a childnode? 1 Answer

Alternate command for rotation on Android ? 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