Changind the position property dynamically and making the model moving more fluidly

Hello,
I have this Cesium based project that consist in showing models and change their position and show property every 4 seconds.
At the moment, I'm just creating all this entities and changing their position with a for that receives the information and search for the correct ID to make the change. If the ID is doesn't exist in the data, the model is hidden.

I have a few questions about this:

1- I'll make a flag that notes if the model doesn't change its position after a few loops and destroy it. Is there a simple away already in Cesium to achieve this?

2- The updated position is received every 4 seconds, but I would like to do something like the HeadingPitchRoll sandcastle example that makes the movement more fluid. I'm trying to read the examples and documentation about primitives and SampledPositionProperty but I'm new to all this and I'm not quite getting it. Anyone has an example or tutorial about this so I can see how it works to try and fit my project to it?
I also notice that in the sandcastle example, the position is changed every render loop, so I tried to change it to setInterval just like I do and it didn't work. Can I preview the velocity of the model based in the two or more lasts positions?

setInterval(function(){
    headingSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.heading).toFixed(1);
    pitchSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.pitch).toFixed(1);
    rollSpan.innerHTML = Cesium.Math.toDegrees(hpRoll.roll).toFixed(1);
    speedSpan.innerHTML = speed.toFixed(1);

    speedVector = Cesium.Cartesian3.multiplyByScalar(Cesium.Cartesian3.UNIT_X, speed / 10, speedVector);
    position = Cesium.Matrix4.multiplyByPoint(planePrimitive.modelMatrix, speedVector, position);
    pathPosition.addSample(Cesium.JulianDate.now(), position);
    Cesium.Transforms.headingPitchRollToFixedFrame(position, hpRoll, Cesium.Ellipsoid.WGS84, fixedFrameTransform, planePrimitive.modelMatrix);

    if (fromBehind.checked) {
        // Zoom to model
        Cesium.Matrix4.multiplyByPoint(planePrimitive.modelMatrix, planePrimitive.boundingSphere.center, center);
        hpRange.heading = hpRoll.heading;
        hpRange.pitch = hpRoll.pitch;
        camera.lookAt(center, hpRange);
    }
}, 4000);

Thank you,
Maria Eugênia Lagua

Hi Maria,

I’ll make a flag that notes if the model doesn’t change its position after a few loops and destroy it. Is there a simple away already in Cesium to achieve this?

Nothing is built in for this behavior that I’m aware of. It seems pretty specific to this situation.

The updated position is received every 4 seconds, but I would like to do something like the HeadingPitchRoll sandcastle example that makes the movement more fluid. I’m trying to read the examples and documentation about primitives and SampledPositionProperty but I’m new to all this and I’m not quite getting it. Anyone has an example or tutorial about this so I can see how it works to try and fit my project to it?
I also notice that in the sandcastle example, the position is changed every render loop, so I tried to change it to setInterval just like I do and it didn’t work. Can I preview the velocity of the model based in the two or more lasts positions?

If I understand correctly and you just want to update the position of your entity with a function I think what you are looking for is a CallbackProperty. You would set your entity position property to a function which you would use to update it’s position over time.

I hope that helps! Let me know if you meant something different.

Thanks,

Gabby