I'm using a sandcastle example to animate an entity by using SampledProperty and clampToGround methods. I want to add height distance between entity and the path on which it is moving.
I have tried the solution given on this link But not getting any change on entity position. Here is the sandcastle link
Solved it by modify code as below:
function start() {
clock.shouldAnimate = true;
var objectsToExclude = [entity];
scene.postRender.addEventListener(function () {
var position = positionProperty.getValue(clock.currentTime);
var clampPos = scene.clampToHeight(position, objectsToExclude);
clampPos = Cesium.Matrix4.multiplyByPoint(Cesium.Transforms.eastNorthUpToFixedFrame(clampPos),new Cesium.Cartesian3(0, 0, 2), new Cesium.Cartesian3());
entity.position = clampPos;
});
}
Sandcastle link