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
0
Question by donutkeith · May 06, 2013 at 02:32 PM · vector3

Y value in Vector3 and Vector3.y not the same

I don't get why my Vector3.y and when I print the vector3 is not the same the y values are not the same. Here is a picture of the output:alt text underlined in blue is the vector3.y and in red the y value of the whole vetor3. Each row is the same vector I just underlined for clarity. In the code I never modify this vector in any way nor the y value. I just use it to check for things in if statements. It's really messing me up that these values are not the same. I understand they are close but why is there a difference at all? How can I get it to give me 0.0 instead of 0.00000000000000009432...?

unity problem.png (27.4 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 Fattie · May 06, 2013 at 02:38 PM 1
Share

You can't, it's just how computers work. It's how floats work. (Indeed, it's how any engineering works, everything has an error when you're building bridges, etc.)

For deep information on how floats work in computing, read-up on a site like stackoverflow or wikipedia. This site is really just for Unity specific questions, not general software engineering questions.

1 Reply

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

Answer by cagezero · May 06, 2013 at 02:46 PM

For a discussion on floating point precision check out this answer:

http://answers.unity3d.com/questions/50187/floating-point-accuracy-weirdness.html

For understanding how to deal with the difference between the printed value and the actual value look at this answer:

http://answers.unity3d.com/questions/167622/vector3tostring.html

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 donutkeith · May 06, 2013 at 02:48 PM 0
Share

thanks for the help

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

14 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

Related Questions

Slerp to make the right/left side face another object 2 Answers

Is it posible to attach a crosshair to an image in vuforia? 0 Answers

assigning vector 3 through scene positioning 0 Answers

How can I assign an Array of Vector3 while seeing and editing the values in the Scene? 0 Answers

FPS Controller Confusion... 0 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