ShiftingOrigin#
This script translates all objects in the world to keep the camera near the origin in order to prevent spatial jittering due to limited floating-point precision.
The script detects when the camera is further than ‘threshold’ units from the origin in one or more axes, at which point it moves everything so that the camera is back at the origin. There is also an option to disable physics beyond a certain point. This script should normally be attached to the viewpoint, typically the main camera.
Members#
Properties#
Optionally provide a list of rigidbodies to avoid doing a FindObjectsByType call. |
|
Optionally provide a list of transforms to avoid doing a FindObjectsByType call. |
|
The mass-normalized energy threshold, below which objects start going to sleep. |
|
The threshold to apply the sleep threshold. |
|
Use a power of 2 to avoid pops in water surface geometry. |
Static Properties#
The amount the origin shifted this frame. |
Events#
Invoked when the origin shifts. |