You can use Matrix4.multiplyByPoint to multiply x,y,z of cartesian3 as given below:
Cesium.knockout
.getObservable(viewModel, "height")
.subscribe(function (height) {
height = Number(height);
if (isNaN(height)) {
return;
}
console.log(entity,"entity");
const cartographic = Cesium.Cartographic.fromCartesian(
entity._position._value
);
const surface = Cesium.Cartesian3.fromRadians(
cartographic.longitude,
cartographic.latitude,
0.0
);
var newHpos = Cesium.Matrix4.multiplyByPoint(Cesium.Transforms.eastNorthUpToFixedFrame(surface),
new Cesium.Cartesian3(0, 0, height), new Cesium.Cartesian3());
entity.position.setValue(newHpos);
});
Here is the working sandcastle example.
- Regards