Keeping the absolute height of entity above ellipsoid

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.

Hello,
If we copy the three lines starting with const llh into the beginning of createPoint, the points that are created all remain the same height above the ellipsoid.
Peek 2022-04-14 14-44

1 Like

@Erixen_Cruz
You have solved my issue perfectly!
Once entity’s height is specified on the ground, I guess it cannot be changed the way I was trying to.
Thanks you so much!

Hi @Erixen_Cruz ,

I hope to ask another question.

I’m facing a new issue on position the points.

I want to get the coordinates of Entity, vertical to the ground, through the coordinates of the mouse.

Just like below, so that I can move around the points that are always vertical to the ground.

I do think that it has something to be with Camera angle but I have no idea to write the code.


Keeping the height even you drug around the entity w/ your mouse.

Thanks,