High-precision coordinate system

32-bit variable type float has low accurate, there are only 7 decimal places. But, I want to have minimum a hundred times more high accuracy. Because, on long distance from origin of coordinates objects shakes.

This problem known ten years ago. There is a solution? If not, where to write to developers, so they can fix it later? Will this action have an effect?

The variant with a stationary player and the moving environment does not offer. There multiplayer is impossible.

Hi and welcome,

You probably have to look into floating origin system, as is the case with all sorts of space travel and also planetary scale things. Unity Wiki has a script just in case you are interested: https://wiki.unity3d.com/index.php/Floating_Origin

And you will probably find quite a few discussions on various forums too if you google it.

Don’t have a stationary player & moving environment. Have a shifting window around origin in which the player can move freely, but once they move outside of it, move everything over X units so that player is at the world origin again. This is viable for both singleplayer and multiplayer.

Edit: Exactly like what @Olmi posted!

I think the problem you’re getting at is object movement on the server with a very large map. There’s no official solution and floating origin isn’t useful on the server side. The only idea I came up with was for my own space game idea was to implement my own double precision transform component, and do all movements with that. On the clients you’d receive updates with the double precision positions of objects and then basically use floating origin, translating the double precision positions to single precision with the client’s camera at or near the origin.

That shouldn’t be all that difficult to implement, except if you need the physics system on the server. You’ll have to implement your own double precision physics system.

1 Like

If you need to do any server-side computation, you can break up the world into logical chunks; each chunk has its own local coordinate space, and a unique chunk coordinate – then everything is resolved in the context of that coordinate system, rather than the world coordinates. This would give you effectively infinite room to play with, though you’d need to deal with transitioning between chunk boundaries. I don’t have an intuition for how much room using a double precision coordinate system like @Joe-Censored mentioned would give you – it’d be worth crunching the numbers to see how big you could go with either approach. A double coordinate grid would certainly be simpler to operate in.

Then, when these coordinates are sent to the client, they are translated into floating-origin world coordinates. This wouldn’t allow for the default physics as it’s all resolved in world space, but if you’re doing server-side physics you definitely don’t want to be using the built-in system as it isn’t built for this kind of use-case regardless (and honestly, if you’re doing something that requires that much space, you probably don’t want to use Unity on the server-side anyway).