Why does everything jitter after a long trip?

Floats run out of precision.

Why does everything jitter after a long trip?

The problem

Positions keep growing.

void Update(){    player.position += velocity * Time.deltaTime;} // at x = 100000, the steps are about 8 mm

A float keeps about 7 digits. Far from zero, its smallest step gets big: about 8 mm at 100 km.

The fix

Move the world back to zero.

When the player gets far from the origin, shift everything back so the player is near zero again.

far from 0→shift every root back→small numbers again

The fix in code

Recenter when you get far.

void LateUpdate(){    var p = player.position;    if ( p.magnitude < 5000f ) return;     foreach ( var go in scene.GetRootGameObjects() )        go.transform.position -= p;}

Everything moves together, so nothing looks different. But the numbers stay small.

Watch out

Not everything follows transforms.

Trails and world space particles keep their own positions. And small worlds don't need any of this.

Root objects
shift them all
Trails, world particles
shift them too
Small worlds
don't need it

The rule

Far from zero? Bring the world back.

float precision
about 7 digits
At 100 km
about 8 mm steps
The fix
a floating origin