Cloning path positions and manipulating on the fly...

1. A concise explanation of the problem you’re experiencing.

Having trouble determining how to maniplate path positions on the fly, reading the values is simple enough but updating them back on the object doesn’t seem quite as simple.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

flightTrack = dataSource.entities.getById(‘varioTrack’);

    var leadingPath = dataSource.entities.getById('leadingPath');    

    // this works
    leadingPath.position = flightTrack.position;

    // something like this doesnt
    leadingPath.position = new Cesium.PositionProperty();
    leadingPath.position.getValue = function(time, result) {
          return flightTrack.position.getValue(time, result);
    };
    
    leadingPath.position.getValueInReferenceFrame = function(time, referenceFrame, result) {
          return flightTrack.position.getValueInReferenceFrame(time, referenceFrame, result);
    };

// I’ve also tried using the callback property without much joy.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

We’re trying to track flight paths which appear to drop below the terrain and become invisible for some parts of the time period, this could be because of bad terrain data, bad GPS readings or a combination of both. We’d like to map any values which are below the terrain to at least sit at ground level

4. The Cesium version you’re using, your operating system and browser.

CesiumJS 1.38

If anyone out there is vaguely thinking they may know the answer to this… cloning the PositionProperty fails silently.

Cesium.clone(flightTrack.position);

(boom, routine stops with no console errors etc.)

I think that you just compared these by reference, then you can't getValue.
Have you tried using a Cesium.CallbackProperty, what didn't work? Using it seems to be the best option in your case, for something that keeps on changing and then make a decision based on that change. the position while doing the calculation you need?
Something like that, say toy store the positions on this array called _positions.

leadingPath. position = new Cesium.CallbackProperty(function(time, result){
   //if (lower then group/terrain) return position of ground or whatever.
   //return _positions (or whatever.
});

As for the Clone comment, what are you triyng to clone? Cesium.Clone isn't the method you need, the position is defined as a Cartesian3, have you tried using Cestains3.Clone instad?

Hope it helps

Yes, Matan’s answer is right on. Cesium.CallbackProperty seems like your best bet. Here’s an example you can model your code on for updating positions on the fly.

Clone will make a copy of a Cartesian, so that’s not really relevant I think.