Large 3D maps, open-world scenes, and VR environments often suffer from floating-point precision issues when the player moves far from (0,0,0). This causes jitter, shaky physics, inaccurate raycasting, and unstable VR tracking.
A Floating Origin System solves this by keeping the player near the origin and shifting the world instead.
Core Idea
Without Floating Origin
- Player moves far from the origin -> precision drops.
- Objects shake, physics breaks, raycasts fail.
- VR head movement becomes jittery.
With Floating Origin
- Player stays near (0,0,0).
- The entire world shifts around the player when they move too far.
- Everything stays smooth and precise.
How It Works
- Check Distance
- If the player exceeds a threshold (e.g., 1000 units), trigger reset.
- Shift World
- Player stays at the origin; world moves instead.
- Sync Physics
- Apply the same offset to all physics bodies (Cannon.js / Ammo.js).
- Networking
- Only shift locally. Global coordinates remain consistent for multiplayer.
Use Cases
- Infinite / procedural worlds
- VR exploration
- Space/flight worlds
- Chunked terrains
- High-precision physics scenes
Advantages
- Removes jitter at large distances
- Keeps physics stable
- Enables huge seamless worlds
- Works well with XR camera rigs
Limitations
- Must shift many objects efficiently
- GPU effects may need offset adjustments
- Requires a global offset tracker for saves/networking
Best Practices
- Reset at 600–1500 units.
- Track a global offset for world-to-local conversion.
- Avoid shifting skyboxes or camera rigs.
- Combine with chunk loading for massive maps.