Using forwardExtrapolationType in CZML

I have the following CZML example where I’m trying to get the model and the billboard to stay aligned in its last orientation before it becomes undefined. The spec says that InterpolatableProperty is supported but maybe it just doesn’t work the way I’m expecting? In the example the model and billboard will snap orientation at the end of the last position timestamp. I am able to get position forwardExtrapolationType to work as expected as the position just holds after the last timestamp.

Hi @Kevin_Ten_Eyck ,
Thanks for your post and apologies for the slow response.

Are you able to provide sample code using our sandcastle tool that reproduces your issue https://sandcastle.cesium.com/

That will be very helpful for using helping us investigate and debug.

Best,
Luke

Yes, it was in the hyperlink above.

const czml = [
        {
            id: "document",
            version: "1.0",
              clock: {
              interval: "2025-02-17T00:00:00Z/2025-02-17T00:02:00Z",
              currentTime: "2025-02-17T00:00:58Z",
              multiplier: 1,
              }
        },
        {
            id: "Example",
            position: {
                forwardExtrapolationType: "HOLD",
                forwardExtrapolationDuration: 0,
                cartographicDegrees: [
                    "2025-02-17T00:00:00Z",
                    -75,
                    40,
                    0,
                    "2025-02-17T00:01:00Z",
                    -75.1,
                    40,
                    0,
                ]
            },
            orientation: {
                forwardExtrapolationType: "HOLD",
                forwardExtrapolationDuration: 0,
                velocityReference: "#position"
            },
            billboard: {
                image: "https://upload.wikimedia.org/wikipedia/commons/1/1f/Green_Arrow_Up%28new%29.png",
                scale: 0.1,
                disableDepthTestDistance: Number.POSITIVE_INFINITY,
                alignedAxis: {
                    forwardExtrapolationType: "HOLD",
                    forwardExtrapolationDuration: 0,
                    velocityReference: "#position"
                },
                distanceDisplayCondition : {
                    distanceDisplayCondition : [10, 2e7]
                }
            },
            path: {
                leadTime: 0,
                trailTime: 60,
                width: 2,
                resolution: 1,
                material: {
                    polylineOutline: {
                        color: {
                            rgba: [255, 255, 0, 255]
                        }
                    }
                },
                distanceDisplayCondition : {
                    distanceDisplayCondition : [0, 1e5]
                }
            },
            model: {
                gltf: "../SampleData/models/CesiumMilkTruck/CesiumMilkTruck.glb",
                scale: 0.25,
                runAnimations: false,
                distanceDisplayCondition : {
                    distanceDisplayCondition : [0, 10]
                }
            }
        }
    ];

const viewer = new Cesium.Viewer("cesiumContainer", {automaticallyTrackDataSourceClocks: true});
const dataSourcePromise = Cesium.CzmlDataSource.load(czml);
viewer.dataSources.add(dataSourcePromise);
viewer.zoomTo(dataSourcePromise);

Extrapolation only applies to sampled properties. In your example, “position” is sampled, while “orientation” is not. There are no samples to extrapolate from.

You could try instead defining orientation using intervals - for example from time t1 to t2 the orientation is defined by the velocity reference, and then from time t2 to the end of the document, it could be defined by a constant value to orient it how you want. That should create a CompositeProperty in Cesium.

Better would be compute the actual orientation at the time of document creation. Client-side finite differencing using velocityReference is helpful for quick experiments but not very good beyond that.

1 Like