Origin Rebasing System

Orbis supports large worlds by implementing an origin rebasing system. This allows the game world to go past floating point precision issues, which start to occur between 10000 und 50000 units. Orbis counteracts that by moving the camera back to zero and shifting the entire world around it.

Information

When the camera and entities/Game Objects get too far away from the center, the rendering and physics can become unstable. This is caused by floating point precision limits. As floats in unity only store 32 bits of data, only a limited amount of precision is available.

To allow bigger worlds, Orbis moves the camera back to zero when it gets too far away from the center of the world. At the same time, all entities with a FloatingOriginRepositionTag are also moved the same amount. So, from the perspective of the camera nothing has changed. However, this also means that the positions of all entities are now different. To allow gameplay logic to continue, the amount an entity has been moved is stored in the FloatingOriginRepositionTag field movedBy.

To calculate the “original” position of an entity, you just need to the current translation and subtract the movedBy again. Note that entities that are not using the Floating Origin Reposition Tag will appear to be moving far away from the camera when the world is shifted, leading to gameplay inconsistencies. To avoid that, add the FloatingOriginRepositionTag to all root-level entities that are important to the scene (using the FloatingOriginMoverBaker).

Performance wise the floating origin system does not have a noticable impact, since the shift only is performed once in a while when the camera gets too far away, and is performed from a burst-compiled job. Both the WorldTransform and the LocalToWorld component get updated at the same time.

Configuration

The threshold at which the camera will be shifted back to the world origin is controlled by the field Floating Origin Reposition Range in the OrbisConfigurator component. As soon as the camera as further away from zero than this value, the floating origin system will move the camera and all entities with the Floating Origin Reposition Tag.