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 Graham Weldon · Oct 18, 2010 at 01:47 PM · guieditorfloatnumber

Unity3D editor not allowing large floats as input

Hey,

I'm trying to accurately represent the Earths mass and relate that to a persons mass to calculate gravitational forces between the two bodies.

I have no issue if the earths mass is set programatically, or calculated. However, I can't seem to input it into the editor. The editor keeps changing the value to something lower, or reverting to my previous set mass on the RigidBody. I'm attempting to set them in the editor so I can place certain planets with specified weights.

Is there a restriction on the float values in the editor thats lesser than that which can be represented in C# scripts in Unity? Or am I going about this in the wrong way?

Cheers.

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 skovacs1 · Oct 18, 2010 at 05:34 PM 0
Share

Where are these floats? Are these $$anonymous$$ass values for rigidbodies? The tooltip on the mass clearly indicates that those values are clamped at 1e-07 and 1e+09 (likely for efficiency). Internally, floating point numbers cannot exceed 9.999946e-41 and 1e+38 without generating a number overflow. I suspect Unity's physics is also internally clamping your programmatically set values when it uses them, making your coded value changes meaningless beyond the clamped values anyways. If it isn't using the your code-set values and you really need them that precise, you will need to calculate your own physics.

1 Reply

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

Answer by starkos · Mar 08, 2011 at 02:39 PM

Perhaps you could compute the force of gravity in a script, using double-precision numbers (use "double" instead of "float"). Then set the computed gravity on the physics manager, or on the specific rigid bodies as needed. If you only need to do this once (like, when you land a new planet) that should suffice. If you need to do it constantly (like, for a spaceship flying near a planet) you could calculate it in Update(), or maybe in a coroutine that fires every few seconds if it isn't changing drastically.

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

No one has followed this question yet.

Related Questions

How To Make Floating Combat Text In new UI System of 4.6 1 Answer

How do I toggle the active state of a canvas UI object 0 Answers

GUI Disappears When I Publish 2 Answers

Drawing Editor Inspector GUI based on selected/current prefab (CustomPropertyDrawer) 2 Answers

How do I prevent "Argument Exception: Getting control 1's position in a group with only 1 controls when doing repaint" in OnGUI function of my CustomPropertyDrawer? 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