Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by zharik86 · Dec 30, 2013 at 09:36 AM · quaternioneuleranglesconverteuler

Quaternion, Eulers and Problems

Good afternoon. I have the following problem with conversion of quaternions. For the explanation I will write the direct code:

 float zAn = 40;
 float yAn = -56;
 Quaternion myq = Quaternion.Euler(0, 0, zAn);
 Cube.rotation = myq;
 Cube.Rotate(Vector3.right, yAn, Space.self);
 Quaternion myqD = Cube.rotation;
 Cube.Rotate(Vector3.forward, -zAn, Space.world);
 Debug.Log("MyAng " + Cube.eulerAngles.x + "  " + Cube.eulerAngles.y + "  " + Cube.eulerAngles.z);

From debug I see (-56, 0, 0). That that also is necessary to me. But a problem that at me myqD is known only. How to calculate zAn if myqD is known only? Thanks in advance for the 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by maxoja · Dec 30, 2013 at 11:37 AM

when you call a variable like Quaternion or Vector3, they wont be update from Cube by itself. It just hang on that value you set in the line so if you want to make it realtime you should set the value of myqD again after you Rotate the Cube.

Just move the this line down to the bottom before the Debugging.

 Quaternion myqD = Cube.rotation;

I'm not sure if my answer is what you want to know so please comment after you read this, I hope it works :)

Comment
Add comment · Show 1 · 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 zharik86 · Dec 30, 2013 at 01:04 PM 0
Share

@maxoja I this value of a quaternion (from a gyroscope). I at first write Cube.rotation = myqD, where with myqD - a gyroscope quaternion. I need to make a certain conversion that eulerAngles were as (xAn, yAn, 0). Conversion shall be provided in a look:

  Cube.Rotate(Vector3.forward, -zAn, Space.world);

Space.world - a main component. I need to find zAn angle from a quaternion. Above in the question I wrote, what conversions it is possible to receive a gyroscope quaternion. But I don't manage to solve the reverse problem (from a quaternion to receive those angles which participate in initial conversion. And it not eulerAngles).

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

19 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

Related Questions

How to fix flipping Euler anlges? 0 Answers

trouble with Quaternion rotation in 360 axis degree 0 Answers

Can't Accurately Read Rotations 0 Answers

Trying to tween the rotation of a cube in x and z and having trouble 2 Answers

Object makes random jumps in rotation 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