I’m attempting to place cylinders at various locations on the globe. The cylinder heights are specified in meters MSL, and I’m needing to place the cylinders immediately as the scene loads… so I’m using sampleTerrainMostDetailed to get the ground elevation at the locations. I’m then calculating the ground MSL for each location using the data from EGM96.
I calculate the above ground height of the cylinder based on the MSL calculations mentioned above. However, when I attempt to draw the cylinders with
I get an error that states “An error occurred while rendering. Rendering has stopped. Cannot read property ‘clone’ of undefined”.
If I allow the heightReference to be Cesium.HeightReference.NONE then I don’t get the error. However, I’m having a hard time figuring out how to position the cylinder so that the bottom of the cylinder is at the terrain/surface.
What is preventing me from using a heightReference of Cesium.HeightReference.CLAMP_TO_GROUND?
If the heightReference is NONE how do I position the bottom of the cylinder at the ground’s surface? It seems like I would set the entity’s position using the height returned from the call to sampleTerrainMostDetailed, but this doesn’t position the bottom of the cylinder at ground/surface level.
I’ve put together a Sandcastle example to show what I’m doing…
Note: If you comment out the cylinder heightReference on line 254 the scene will load, but the cylinders are not being positioned at the correct height.