CesiumGlobeAnchor double field deprecation problem

When controlling animation, it was found that the tween animation could not use double3 type, but could only use double, so the double field of CesiumGlobeAnchor was used, but it was found that it would be discarded, so I suggested whether it could be retained

tween4 = DOTween.To(() => cesiumGlobeAnchor.longitude, x => cesiumGlobeAnchor.longitude = x, (double)posx, duraFlyIotTime).SetEase(Ease.Linear);
            tween5 = DOTween.To(() => cesiumGlobeAnchor.latitude, x => cesiumGlobeAnchor.latitude = x, (double)posy, duraFlyIotTime).SetEase(Ease.Linear);
            tween6 = DOTween.To(() => cesiumGlobeAnchor.height, x => cesiumGlobeAnchor.height = x, (double)posz, duraFlyIotTime).SetEase(Ease.Linear);

The longitude, latitude, height and ecefX, ecefY, ecefZ fields were all deprecated a while ago in v0.3.0. This change was recorded in the changelog, and you can see the “Obsolete” message at the top of the function.

For your purposes, you’d probably have to make copies of the double3 components, In other words, separate the double3 into three double variables, animate the individual variables, and then reassemble them into a double3.

Now the use of these three attributes in the program is still valid, marked deprecated, worried that it will not be available later.

Because longitudeLatitudeHeight attributes only the overall assignment, longitudeLatitudeHeight. X can read can’t assignment, led to the three assignments. The test tween will not run smoothly.

            double lx = cesiumGlobeAnchor.longitudeLatitudeHeight.x;
            double ly = cesiumGlobeAnchor.longitudeLatitudeHeight.y;
            double lz = cesiumGlobeAnchor.longitudeLatitudeHeight.z;
            tween4 = DOTween.To(() => lx, x => lx = x, (double)posx, duraFlyIotTime).SetEase(Ease.Linear).OnUpdate(() =>
            {
                cesiumGlobeAnchor.longitudeLatitudeHeight = new Unity.Mathematics.double3(lx, cesiumGlobeAnchor.longitudeLatitudeHeight.y, cesiumGlobeAnchor.longitudeLatitudeHeight.z);
            });
            tween5 = DOTween.To(() => ly, x => ly = x, (double)posy, duraFlyIotTime).SetEase(Ease.Linear).OnUpdate(() =>
            {
                cesiumGlobeAnchor.longitudeLatitudeHeight = new Unity.Mathematics.double3(cesiumGlobeAnchor.longitudeLatitudeHeight.x, ly, cesiumGlobeAnchor.longitudeLatitudeHeight.z);
            });
            tween6 = DOTween.To(() => lz, x => lz = x, (double)posz, duraFlyIotTime).SetEase(Ease.Linear).OnUpdate(() =>
            {
                cesiumGlobeAnchor.longitudeLatitudeHeight = new Unity.Mathematics.double3(cesiumGlobeAnchor.longitudeLatitudeHeight.x, cesiumGlobeAnchor.longitudeLatitudeHeight.y, lz);
            });

Yeah, that won’t work. But you don’t need those properties. Do something like this:

tween4 = DOTween.To(
  () => cesiumGlobeAnchor.longitudeLatitudeHeight.x,
  x => {
    var value = cesiumGlobeAnchor.longitudeLatitudeHeight;
    value.x = x;
    cesiumGlobeAnchor.longitudeLatitudeHeight = value;
  },
  (double)posx, duraFlyIotTime).SetEase(Ease.Linear);

Thanks. My poor understanding of lambda grammar caused such problems. Thanks again。