A problem with "entities.add(feature)" after i set the terrainProvider

Hi Cesium Team, I am now having a problem. I use "entities.add (feature)"When I did not set the terrainProvider , the added feature's location is the coordinates I provided, but after I loaded the DEM and set the terrainProvider, the added feature was offset and it's coordinates is not the coordinates that i set in "position: Cesium.Cartesian3.fromDegrees(parseFloat(val.longitude), parseFloat(val.latitude),tempheight),"

my code:/* i get the coordinates and height by click */
      var camera=that.ol3d.viewer.scene.camera;
      var ellipsoid = that.ol3d.viewer.scene.globe.ellipsoid;
      that.handler = new Cesium.ScreenSpaceEventHandler(that.ol3d.viewer.scene.canvas);
  that.handler.setInputAction(function(click) {
  that.cartesian = camera.pickEllipsoid(click.position, ellipsoid);
                                if (that.cartesian) {
                                var cartographic = ellipsoid.cartesianToCartographic(that.cartesian);
                                var height=that.ol3d.viewer.scene.globe.getHeight(cartographic);
                                that.longitudeString = Cesium.Math.toDegrees(cartographic.longitude);
                                that.latitudeString = Cesium.Math.toDegrees(cartographic.latitude);
                                \('\#tempheight'\)\.html\(height\);                                 ("#temp2").html("经度:"+that.longitudeString+",纬度:"+that.latitudeString+",高程:"+that.height)

}, Cesium.ScreenSpaceEventType.LEFT_CLICK);

/*then i need display the point i where i click */
        var temp = \("\#temp2"\)\.html\(\);         var tempheight=("#tempheight").html();
        var myarray =temp.split(/[:,]/);
        result.longitude = myarray[1];
        result.latitude = myarray[3];
            .each(function (i, val) {
            var feature = {
                    parent: layer,
                name: "longitude" + i,
                position: Cesium.Cartesian3.fromDegrees(parseFloat(val.longitude), parseFloat(val.latitude),tempheight),
                heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
            billboard : {
                    image : 'images/icon/u12111.png', // default: undefined
                    show : true, // default
                    eyeOffset:new Cesium.Cartesian3(0, 0,-60),
                    pixelOffset : new Cesium.Cartesian2(0, -10),
                    scale : 0.5,
                    horizontalOrigin : Cesium.HorizontalOrigin.CENTER
   data: val
            var tmpentiy = that.ol3d.viewer.entities.add(feature);
            that.ol3dlist[val.stationcode] = tmpentiy;
/* the result.latitude , result.longitude and tempheight is just the value
where i click .when i do not set the terrainProvider,The Cesium without Terrain,the feature'location is the position i wanted .But,when i set the terrainProvider " var terrainProvider = new Cesium.CesiumTerrainProvider({

                 url : ‘http://localhost:8080/terrain_tiles’,
          }); this.viewer.scene.terrainProvider = terrainProvider;"
the feature’coordinates is not the result.latitude and result.longitude.i don’t know why ..Please help..If you can, hope to talk directly by facebook,My account is 530109755@qq.com
/*** I am a Chinese , so forgive me my English is not very good..***/

Hi there,

One problem is that you seem to be passing in a height value, but you’re also using CLAMP_TO_GROUND, which should ignore the given height value and put your billboard on the terrain. You also seem to be using heightReference outside the billboard object, which is unnecessary.

Hope that helps,

  • Rachel