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 /
This question was closed Oct 21, 2013 at 11:18 AM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by TargonStudios · Oct 21, 2013 at 12:12 AM · rotationguitransformdisplay

Displaying Z Rotation through script

So I have created a dandy Airplane script, while your flying it displays your Speed, Turning Speed, Rotating Speed, ect. But I also want to display the Z Rotation of the airplane to help players know where they are but have no idea how to. Ive tried looking it up but all it brings me to is how to rotate an object which isn't what I want. I know theres probably a very simple answer but how would I be able to find out the Z Rotation through script and display it? Here is a snippet out of my script to show what Im trying to show. (This Displays the speed the player is going up/down)

 if (GUI.Button (Rect (20,40,160,20), "Y-Speed: " + YSpeed)) {


 
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

  • Sort: 
avatar image
0
Best Answer

Answer by sethuraj · Oct 21, 2013 at 06:21 AM

Use 'transform.rotation.z' to get the z rotation value of any transform.

Comment
Add comment · Show 2 · 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 TargonStudios · Oct 21, 2013 at 10:52 AM 0
Share

Thanks, worked.

avatar image robertbu · Oct 21, 2013 at 03:01 PM 0
Share

It may have "worked," but it is not a good solution. Transform.rotation is a Quaternion which is a 4D, non-intuitive construct. The values go from 0.0 to 1.0. You can use transfrom.eulerAngles, but note the are multiple euler angle representations for any physical rotation, so the angle you get back may not be the one you expect.

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Finish rotation in the same angle of beginning? 1 Answer

Displaying the Y-value of the transform for the main camera 1 Answer

How to ignore rotation while moving? 1 Answer

How to get my own rotation 1 Answer

accessing an array of rigidbodies at once? c# 2 Answers


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