Hello,
I keenly need help as I have been doing this for whole day,
I’ve been working on how to keep the absolute height of the point entity above ellipsoid.
However, my code below keeps the point entities clamping to the terrain.
Trying to keep dynamic entity with fixed height
In my understanding, this part of the code should make it work but couldn’t,
function createPoint(worldPosition) {
const point = viewer.entities.add({
position: worldPosition,
point: {
color: Cesium.Color.RED,
pixelSize: 20,
heightReference: Cesium.HeightReference.NONE,
},
});
return point;
}
handler.setInputAction(function (event) {
if (Cesium.defined(floatingPoint)) {
const newPosition = viewer.scene.pickPosition(event.endPosition);
if (Cesium.defined(newPosition)) {
const llh = Cesium.Cartographic.fromCartesian(newPosition);
const llh_fixed = new Cesium.Cartographic(llh.longitude, llh.latitude, 5000);
const newPositionFixedHeight = new Cesium.Cartographic.toCartesian(llh_fixed);
floatingPoint.position.setValue(newPositionFixedHeight);
activeShapePoints.pop();
activeShapePoints.push(newPosition);
}
}
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
The height should be always at the same height from ellipsoid.
Not important now but I need to make the point entities to be able to be dynamically changed, after the issue above is solved.
It is really appreciated any advice.
Thanks.