Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Oyshoboy · Jan 25, 2017 at 07:55 AM · unity 5rotationposition

How to get Objects, Rotation?

Hi everyone! I'm trying to track objects Z rotation, through ChassieRotation = transform.eulerAngles.z;, but it's got several problems:

1st problem: When I start project, transform.eulerAngles.z; returns strange value -7.017183e-15. That's makes me sad.

2nd problem: transform.eulerAngles.z; returns different value, as object's Z rotation. I need to catch rotation on - 90.

How can I get actual object's Z rotation value?
And What is this mysterious value -7.017183e-15?

( video : https://www.youtube.com/watch?v=5BwXYViKBIA )

alt text



alt text

e7c43e0cfe.png (128.2 kB)
5610f59b5e.png (180.0 kB)
Comment
Add comment · Show 1
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 Oyshoboy · Jan 25, 2017 at 07:50 AM 0
Share

Resolved it by using triggers, but anyway interested in answering of questions above.

1 Reply

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

Answer by malkere · Jan 25, 2017 at 09:04 AM

the pictures you posted are showing correct outputs. -7.017183e-15 is basically 0.00000000000007. while -90 is also basically 270 because -90 plus 360 is 270. the e-15 means the decimal place has been moved 15 spaces.

Comment
Add comment · Show 7 · 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 Oyshoboy · Jan 25, 2017 at 03:42 PM 0
Share

Yes, but can I catch Default rotation values?

avatar image malkere · Jan 25, 2017 at 10:51 PM 1
Share

Well if you were trying to get zero and 270(-90) in those cases you just need to adjust the number. using an if (rotation < 0) { rotation += 360 } else if (rotation > 0) { rotation -= 360 } will make sure you always get 270 not -90. and if you $$anonymous$$athf.RoundToInt(rotation) you can get 0 ins$$anonymous$$d of 0.7e-15. Is that what you wanted?

avatar image Oyshoboy malkere · Jan 26, 2017 at 03:56 AM 0
Share

I guess yess, so it's inpossible to get default values? Not modified?

avatar image malkere · Jan 26, 2017 at 10:20 AM 1
Share

I'm not sure what you mean by "default values," 0-360? What is rotating the landing gear? Unity doesn't automatically jump from 0 to 359 when going backwards, but you can certainly do it yourself if you want to measure things strictly. I often add a if (value < 0) { value = 0; } after I subtract something to make sure it doesn't go negative. Unity will just do what it tells you so you just have to figure out smarter ways of controlling your commands.

avatar image Oyshoboy malkere · Jan 27, 2017 at 10:10 AM 0
Share

I need to catch this value: http://joxi.ru/$$anonymous$$AjGQy8i4dgRVr

Is it possible?

avatar image malkere Oyshoboy · Jan 27, 2017 at 10:47 AM 1
Share

I did some research and it looks like it is not possible. There really should be no reason for you to need that number though. If you control the code properly it will always be exactly the number you want it to be regardless of what the inspector says. There was an in depth discussion about it here: https://forum.unity3d.com/threads/how-to-get-euler-rotation-angles-exactly-as-displayed-in-the-transform-inspector-solved.425244/

Show more comments

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Accurate placed object's transform messes up on game start 1 Answer

Draw 4 points around object 1 Answer

[Unity 3D] How to detect if the game object is left right from the player? 0 Answers

Objects not always Spawning At Correct Location 2 Answers

how to ignore transform.position.y 3 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