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
1
Question by hog · Jul 19, 2012 at 10:03 AM · transformeuleranglesdegree

Question about Transform.eulerAngles ?

I tried to get a object's rotation angle by read that eulerAngles variable, so i made a simple test script: rotate a object around x-y-z axis individually with transform.rotate() function, and print the eulerAngles to console. For y and z axis,everything looks just fine,0 to 360. But for x axis, things looks wierd. For a rotation form 0 to 360 degree,it shows a cricle like 0 to 90,then 90 to 0, then 360 to 270 and 270 to 360,what is this ... I can't really understand it. :(

Comment
Add comment · Show 6
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 J Lam · Jul 19, 2012 at 10:09 AM 0
Share

any sample script you could provide for us to help?

avatar image hog · Jul 20, 2012 at 12:57 AM 0
Share

I asked this question several times on Internet, all the big shots told me same thing like "hmm, u should know that 'quaternion' stuff blah blah blah

I do know that ‘quaternion' things a little bit , it's a bit complicated but still comprehensible,nothing like alien technology at all.

Anyway if Unity provided a variable like EulerAngles, it should work properly, that is a vary basic function to a 3D game engine.It works fine on y and z axis, but not for x axis. That can't be a 'functional purpose'.An object rotated around x-axis by 100 degree but represent a 80 degree in it's transform.eulerAngles.x variable, that confused me a lot.

Since the object do know how to represent itself on screen correctly , why can't i get a right eulerangle measure? or where can i get it? Should i work with those Quaternions(x,y,z,w) stuff directly? Should i collect all the rotation in my script manually? Even for those objects controlled by physical engine?

avatar image DaveA · Jul 20, 2012 at 12:59 AM 0
Share

You should really either edit your original question or use the 'comment' button, unless you are really answering your own question

avatar image Eric5h5 · Jul 20, 2012 at 01:05 AM 0
Share

Euler angles do work properly. I already explained that there's more than one valid way to represent a rotation with euler angles; quaternions must be used in order to avoid gimbal lock.

avatar image hog · Jul 20, 2012 at 01:23 AM 0
Share

Then is there any way that i can get a proper eulerangle for x-axis in Unity? I DID NOT try to set eulerangle, just want to read it, there is nothing about gimbal lock. If your just try rotate your object inside Unity editor around x-axis, it shows same thing just like what i said. Is that a 'peoper way' to rotate an object?

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Eric5h5 · Jul 19, 2012 at 02:14 PM

Rotations are stored internally as quaternions, and there's more than one valid way to represent a rotation as euler angles when it's converted (for example, 0, 0, 0 is the same as 180, 180, 180). So reading a single x/y/z element of euler angles is not advised.

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 hog · Jul 19, 2012 at 06:51 PM 0
Share

Thanks Then how can i figure out a object's rotation angle at run time? by degree anyway. I would not like to work with those quaternion things directly.

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

7 People are following this question.

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

Related Questions

My object isn't rotating to the transform of another object. How do I fix this? 1 Answer

EulerAngles value as floating point 1 Answer

Particle System wont play? 1 Answer

How to find an object's rotation in 2D 1 Answer

Character Controller change target direction in degree 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