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
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.
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.
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.
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.
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")
Croteam used clever scaling trickery in Serious Sam to simulate a large area and things being in the distance. They weren’t actually that far away, they were just really really small.
the scale is not usually the problem . The problem is the resolution . you can’t have both with floats. IMHO , there is no way other than coding -by hand- the entire engine in doubles. and that includes the transforms, also the physics solver and the rigidbody system , That took us quite a few months of intensive coding. But once is done you ll forget for ever any further issue with float accuracy.
Check this project:
For anyone still looking for double precision support in Unity, you may be interested in this project: Home · egable/unity-dots-physics-double Wiki · GitHub