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 AntFitch · Mar 14, 2013 at 02:04 AM · positionvector3

postion that is small number rounded to 0?

I've run into a weird problem. If I change the Z postion of a gameobject to .000001 inside the Hierarchy tab, the position is output as -1e-06 in scientific notation. Not a problem, everything seems works great.

Now, when I attempt to set the Z position to .000001 via Vector3 in my script, the Z position is changed to 0 and also appears as 0 in the Hierarchy tab.

I've attached some screenshots. Hopefully it will help.

http://answers.unity3d.com/storage/temp/8915-smallzproblem-script.png http://answers.unity3d.com/storage/temp/8917-smallzproblem-inspector.png

smallzproblem-script.png (14.1 kB)
smallzproblem-inspector.png (12.2 kB)
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

· Add your reply
  • Sort: 
avatar image
0

Answer by Seth-Bergman · Mar 14, 2013 at 02:21 AM

you probably shouldn't be dealing with scale that small anyway...

in your first image, it seems all three values are rounded

most likely the second example is as well, but to a further decimal than 3 places...

by dragging an object around in a test it seems to be 6 places:

alt text

.0000001 still rounds to zero

EDIT: oh you have .000001 let me test...

upon testing I am unable to recreate your issue.. I add the line:

  transform.position.z = .000001;


and 1e-06 is my result:

alt text

I tried

 transform.position = Vector3(0,0,.000001);


as well same result

OK, I tried adding even more zeros

  transform.position = Vector3(0,0,.000000001);

it still works as 1e-09

so I don't know...


transformtest.jpg (52.1 kB)
transformtest2.jpg (33.8 kB)
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 AntFitch · Mar 14, 2013 at 06:17 PM 0
Share

Thank you Seth! I wonder if this might be a Unity bug in the Hierarchy tab? I tested, and even though Z shows up as 0 for me, the Z position is calculated properly on screen (one sprite appears correctly in front of another in my 2d game).

It's strange. Sometimes I get the 0, sometimes I get the scientific notation.

avatar image Seth-Bergman · Mar 14, 2013 at 07:56 PM 0
Share

is it possible there is something else going on in the script which affects this, or is your code as simple as a single line like my examples above? (because it works every time for me.. I am unable to recreate this issue so far) If there is any more to it, posting the relevant code may 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

11 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

Related Questions

Problem with Prefab 2 Answers

Check if 2 objects positions are close enough 2 Answers

Creating a bouncing game without using physics - Vector3 math problem, 2 Answers

How to keep the same position of the object instead of camera 0 Answers

crouch script 4 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