- Home /
maximum distance from origin (float precision)
Ok, so players can travel up to about ~12km from origin in many directions. I believe I would need CM accuracy (player is about 1.5m in height) to produce desirable effects. My research on floating points has led me to believe that floats have ~7.2 decimal places of precision. 12,000.01 has seven digits, and would have cm accuracy, is this assumption correct? I have seen people claim that float precision has been the cause of issues in multiple cases, some claiming around 20km, others around 40km, and I saw one guy post a quote from unity reference saying something along the lines of 99km should be fine, but a warning will generate and issues arise past that. I have not seen this in the reference myself, he did not post a link.
Could someone clarify this for me? is my world too big to have players moving accurately at such distances? If not, could i push it to 20km safely? That is the biggest I could imagine ever using. I want to know the limits before I wing it with trial and error.
World coordinate size is relative. You can assign any scale you like to your coordinates.
But if you are expecting to have a continuos scene big enough that you cannot fit it all into an appropriate range of a float when properly scaled, I would reconsider your plans as its not likely to fit in memory or otherwise scale to that sort of size, anyway.
Google keeps popping this when searching "unity floating point range limit" or alike. Hence the necro. So eventually, what is the $$anonymous$$imum reliable range? According to comments in youtube.com/watch?v=G5UTyC6IpSI it can get as low as 3000 units (shadows). The inspector warns at 1000000. Can we have a definitive response? Some actual value we can count on? Also see this post in the forums.
Your answer
Follow this Question
Related Questions
Convert double to float for Vector3 1 Answer
Vector3 using Doubles Instead of Floats 2 Answers
Losing float precision when adding to Vector3 1 Answer
CharacterController.Move precision 1 Answer