Currently, CesiumOriginShift sets the origin of its parent georeference every frame. This change adds an activation distance property and a checkbox to enable it. If enabled, the origin will only be shifted when the position of the CesiumGlobeAnchor is greater than activationDistance meters away from the parent CesiumGeoreference.
Originally, this change produced a strange bug with the CharacterController used by CesiumCameraController. I've fixed that bug by moving the movement code in CesiumCameraController to FixedUpdate, as it's manipulating a physics object. In addition, Physics.SyncTransforms needs to be called when updating the origin, so that the physics system is informed of the CharacterController's new position.
I've also added a test for this bug as well as a test for the activation distance property itself.
@j9liu Updated based on review! I tried comparing profiler results from before and after the changes but nothing seems to jump out at me. I can't tell myself if it's slower or not.
Fixes #182.
Currently,
CesiumOriginShift
sets the origin of its parent georeference every frame. This change adds an activation distance property and a checkbox to enable it. If enabled, the origin will only be shifted when the position of theCesiumGlobeAnchor
is greater thanactivationDistance
meters away from the parentCesiumGeoreference
.Originally, this change produced a strange bug with the
CharacterController
used byCesiumCameraController
. I've fixed that bug by moving the movement code inCesiumCameraController
toFixedUpdate
, as it's manipulating a physics object. In addition,Physics.SyncTransforms
needs to be called when updating the origin, so that the physics system is informed of theCharacterController
's new position.I've also added a test for this bug as well as a test for the activation distance property itself.