Shifting Origin
Prevents floating point precision errors by shifting all scene objects toward world origin when the main camera exceeds the distance threshold. The shift is transparent to gameplay - relative positions remain identical.
Key Properties
- distanceThreshold (default: 500m) - Distance from origin that triggers a shift
- onBeforeJump - Event invoked before shift begins (Rigidbody sleep thresholds temporarily disabled)
- onAfterJump - Event invoked after shift completes (physics re-synced)
- TotalOffset (read-only) - Cumulative offset applied since scene start, useful for tracking absolute world position
Runtime Cache Management
Call RefreshCaches() after adding new Rigidbodies or ParticleSystems to the scene at runtime to include them in origin shifts.
Important Notes
- Only one ShiftingOrigin instance per scene
- Uses Camera.main as reference point (checked every 60 frames for runtime switching)
- Affects all loaded scenes
- Automatically handles world-space particle systems
Note: ShiftingOrigin is part of NWH Common. For full documentation including setup examples, networking considerations, and best practices for large worlds, see NWH Common - Shifting Origin.