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 /
  • Help Room /
avatar image
0
Question by psdev · Mar 25, 2011 at 03:15 AM · rotationinspectorvalueviewport

Why does rotating via viewport give different values than inspector rotations?

For some reason I am not understanding how/why rotating items via the viewport handles (such as a character's knee bone) works differently than entering a text value for the rotation into the inspector.

Like why do the values keep rotating to multiples of 360 and when do they reset to 0-360? i.e. why does the inspector show -1440 sometimes instead of 0?

Also see these screen shots to see what I mean about viewport vs inpector rotations? I would expect them to work the same like in other 3D apps such as LW where the text fields match exactly whether you enter a value or click and drag.

And in my examples another weird thing that the Unity IDE does, is that it changes the Y & Z values even when I have ONLY clicked on the locked X axis handle to constrain rotation via the viewport. Hopefully these screenshots show you what I am confused about. Any help is appreciated :)

step 1 step 2 step 3 step 4 step 5

(this is Unity 3.3 windows btw)

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

2 Replies

· Add your reply
  • Sort: 
avatar image
3
Best Answer

Answer by loopyllama · Mar 25, 2011 at 04:40 AM

You are viewing the rotation through euler angles, or an x y z in degrees. Internally the rotation is represented through quaternions which is 4 floats (these 4 floats are not simply angles or degrees). To answer your question a 0 degree rotation is the same thing as a 360 or -360 degree rotation...meaning your model is at the same angle, at that frame. You will see equivalent values "flicker" like this is the viewport because you are viewing the internal quaternion converted to an euler angle. Rest assured knowing there is nothing broken about this and it is normal. Quaternion's solve the problem of gimbal lock which plagues euler angles.

Comment
Add comment · Show 11 · 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 psdev · Mar 27, 2011 at 08:46 PM 0
Share

Thanks, I appreciate your response, and I understand that 0,-360 and other multiples are the same thing - but I'm assu$$anonymous$$g it would be nice to have the viewport report consistent values. For example, why does undo report -360 when it was 0 a second ago? And isn't gimbal lock just dealt with by using Local vs World coordinates?

Also, can you address why if I want to constrain rotation to the X axis, why other Y & Z values change when using the viewport, but (correctly so) not via just entering a value in the X textbox? To me that is highly strange...?

avatar image Jesse Anders · Mar 27, 2011 at 11:57 PM 0
Share

Regarding display of Euler angles, although it's possible to display Euler angles in 'canonical' form and get more consistent results, it's not that important overall, I$$anonymous$$O. Aliasing is an inherent characteristic of Euler angles, and is just something that has to be expected when working with them. As for gimbal lock, quaternions don't really 'solve' the problem of gimbal lock, per se. Whether gimbal lock is a possibility is more a function of how your orientations are stored and manipulated. (That's a little brief, but I'm out of characters :)

avatar image psdev · Mar 28, 2011 at 03:32 AM 0
Share

Thanks for your clarification, and I'm sorry I'm being dense here. I think it's less of me debating Quaternions vs Euler and more contesting how the Unity Inspector IDE works unexpectedly (at least for me in comparison to Lightwave layout).

For example see the 2nd image above - why does the Y & Z change to -180 when all I did was rotate the X axis in the viewport?? is this an equivalent angle or something? Can't the IDE tell I only wanted to rotate X alone? Does my confusion make sense? Hope I don't run you out of characters again ;-)

avatar image loopyllama · Mar 28, 2011 at 10:20 AM 0
Share

when you type in a rotation into the inspector you are entering an euler angle that gets converted to a quaternion internally. when you rotate in the viewport you are seeing the value change in the inspector that is a quaternion converted to an euler angle, which can and will "flicker" depending on the direction and amount of rotation.

avatar image loopyllama · Mar 28, 2011 at 10:23 AM 0
Share

and for clarity, quaternions are indeed free of gimbal lock. here is more info about gimbal lock with pretty pictures: http://en.wikipedia.org/wiki/Gimbal_lock#The_quaternion_solution

Show more comments
avatar image
0

Answer by jeffreylmeyer · Dec 05, 2016 at 02:12 AM

So how do we calculate the same values the inspector shows? For example if I have Inspector values of: Transform.rotation.x = 160 , .y =-30, .z=0 how do I get those values in C#?

The engine should provide that in a simple manner... I'm guessing somehow they convert 0 to 360 into -1 to +1 ??? and what is the point?

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

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

1 Person is following this question.

avatar image

Related Questions

How do I see what Reference properties and Value properties I can address in GetComponent in C#? 0 Answers

Inspactor Roation to Vector3 0 Answers

Project turns "read only" after a while 0 Answers

automatic levelling out airplane when near the ground? 0 Answers

Very basic rotation BUG. transform.up = transform.up sets Y rotation to 0. 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