Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Johan 4 · Feb 23, 2011 at 05:33 PM · rotationquaternion

Get object rotation angle.

How can I get object's rotation angle. If I use transform.rotation it gives not the angle.

I know you have to use quaternion, but I am not sure how to do this. Please tell me.

Thanks.

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
7
Best Answer

Answer by _MGB_ · Feb 23, 2011 at 05:58 PM

Does Transform.eulerAngles give what you need?

Comment
Add comment · Show 5 · 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 jaxx0rr · Jun 20, 2014 at 02:47 PM 0
Share

if the object flips (and it will) then it displays a wrong value..

avatar image meat5000 ♦ · Jun 20, 2014 at 02:49 PM 0
Share

If you know this will happen you can compensate for it in your script. You pretty much end up doing that a lot with eulerAngles.

avatar image shadowpuppet · Mar 22, 2019 at 04:12 PM 0
Share

Ya know, the problem with giving people links to an answer rather that just repeat it or copy/paste the answer, is that when people like me are looking for an answer years from when you posted your reply....the link is long dead. useful pages removed while total waste of time pages - like this one- remain

avatar image Bunny83 shadowpuppet · Mar 22, 2019 at 05:37 PM 0
Share

That wasn't a link to an "answer" but simply a link to the documentation. This question and answer is over 8 years old. Things always can change over time. You have a copy of the documenation along with your Unity installation so you can look it up locally in the documentation.


Anyways I've updated the documenation link. Btw: copy and pasting an answer is actually the wrong thing. We actually close duplicate questions.

avatar image shadowpuppet Bunny83 · Mar 22, 2019 at 07:52 PM 0
Share

right, if I had the documentation I wouldn't be looking online. I started on v.3.4 or something and that was awhile ago. I have upgraded as far as I can without breaking the crap out of my game ( 4.9,..... 5 anything breaks it to pieces) and I do not see any documentation on my computer anywhere. I know the answer is old but answers are answers and the right ones are ageless. Just saying it is frustrating to google answers and 7 out of ten take you to dead links. If the page sending me there has no value then why not just delete it? perhaps doesn't really take up that much server space but neither did the links I was being sent to.

but thanks for the updating of the documentation but still stuck. Tried various things. I simply want to know if the plane in my flight sim is angled up or down. That value seems to change from pos to neg depending on which direction I am fling along Z. I did come across that info you updated in the link. Pretty cool but the values still wouldn't give me what I hoped for. positiveX if I climb, NegativeX if I dive. Using the mouse to do this I am able to get the value from the mouse movement accurately , but it always returns to zero ( the mouse value) so it doesn't say I climb or dive for very long. Probably doing something wrong . $$anonymous$$aybe Time.deltaTime? Doesn't really matter because I was unable to successfully change the sound pitch for the climb ( only the dive) and, again , it wouldn't last long. On a fools mission

avatar image
0

Answer by muhammadtahiriqbal · Aug 28, 2015 at 12:25 PM

float Angle=Quaternion.Angle(Quaternion.Euler(new Vector3(0,0,0)),transform.rotation); this give the angle b/w two rotations

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Is there no way to get reliable angles from a rigidbody? 2 Answers

Quaternion Rotation On Specific Axis Issue 0 Answers

Extrapolating Quaternion Rotation 2 Answers

Make Quaternion affected by float 1 Answer

Rotation of an object with quaternion 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