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
3
Question by xeHidden · Nov 01, 2010 at 01:29 PM · precision

How do i use double precision vector3? Is this possible?

Hi,everyone. I have a very huge scene,and the transform.position overflow the vector3's float precision(7 valid number). Why there isn't double precision vector3? Anyone can solve this problem? thanks

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 Max Kaufmann · Nov 04, 2010 at 07:26 AM 1
Share

Scale down the scene - IEEE floating-point values have greater precision as you approach zero (half the possible values are "denormalized", i.e., in between -1 and 1).

9 Replies

· Add your reply
  • Sort: 
avatar image
7

Answer by _Petroz · Nov 25, 2010 at 12:07 AM

Unless I'm missing something, I don't think floating point accuracy is related to scale, they have 7.22 digits of accuracy regardless of where you put the decimal point. http://en.wikipedia.org/wiki/IEEE_754-2008

If you are experiencing 'Spatial Jitter' due to floating point inaccuracy, here is a paper explaining the problem and possible solutions:

http://www.floatingorigin.com/pubs/thorneC-FloatingOrigin.pdf

I wrote this implementation: http://wiki.unity3d.com/index.php/Floating_Origin

If you try it out, please let me of any improvements that could be made.

Comment
Add comment · Show 6 · 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 Waz · Oct 29, 2011 at 02:01 AM 2
Share

While it's not "related to scale", it does prevent you having small and large scale objects at the same time. When the questioner says that his scene is "huge", we can assume it also contains small things. It is this difference in scales that cases floats to fail.

avatar image jasonbelmonti · Dec 02, 2011 at 03:56 PM 0
Share

this is S$$anonymous$$ART!

avatar image DSebJ · Dec 21, 2013 at 12:35 AM 0
Share

Awesome implementation, thank you!

avatar image jpthek9 · Nov 21, 2014 at 03:55 PM 0
Share

Hi, I know this is an old question but I could really use some help on this. The unifycommunity.com website has unfortunately shut down and I can't see your solution. I'm making a semi-deter$$anonymous$$istic multiplayer RTS game and I could really use some help with the imprecision of floats.

avatar image zero3growlithe · Jan 14, 2015 at 09:32 AM 0
Share

here: http://wiki.unity3d.com/index.php/Floating_Origin

Show more comments
avatar image
2

Answer by Eric5h5 · Nov 01, 2010 at 03:20 PM

There's no way to use double precision floats for Vector3. Either scale things down, or use some technique where you have "local" and "world" coordinates in order to represent large areas.

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
avatar image
2

Answer by Waz · Oct 29, 2011 at 02:02 AM

To have a very large game area (eg. Solar System) with small objects (eg. a space ship, warp drive button), you will have to divide the space into areas and only logically have them distant from each other.

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
avatar image
1

Answer by jcarrion · Nov 19, 2014 at 02:21 PM

There is indeed a double precision physics library around for Unity. We use it for our project www.space-simulator.com . All position , velocities , angles, transforms, etc etc.. are templated so we can choose Vector3s , DVector3 , etc.. .as required.

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 YinYin Falcon · Nov 24, 2014 at 06:13 PM 0
Share

Where did you get that library?

avatar image kzaurckichz · Dec 01, 2014 at 04:57 AM 0
Share

$$anonymous$$e too I'd really like to get that library. I'd pay a good price for it. Can't find it in Unity asset store, what is it called ? Thanks

avatar image
0

Answer by IJM · Nov 01, 2010 at 01:49 PM

Oo how did you do that? There is really no need to do something like that. I recommend you to scale your meshes down. This will help you: (Look for "Scale factor")

http://unity3d.com/support/documentation/Manual/Meshes.html

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 xeHidden · Nov 01, 2010 at 03:21 PM 0
Share

thanks IJ$$anonymous$$,but my scene camera's transform position data uses another application through a UDP dll,and sometimes the position data may greater than (200000.000,0,200000.000),so I think use this "Scale factor" will lose the precesion. So,Is there another solution ?

avatar image IJM · Nov 01, 2010 at 06:46 PM 0
Share

Just try it, precesion will be more than fine =)

  • 1
  • 2
  • ›

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Infinite space, precision problems, and multiplayer 0 Answers

Problem with animation precision 0 Answers

How to set compute shader float precision to half explicitly in Unity 2022 and Direct3D12? 1 Answer

Scene scale and float precision 1 Answer

Phyics.Raycast alternatively returns True/False with static input 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