Create shape on model in cesiumJS

i was trying to create a shape that covers a surface on building model that overlayed into simple cesium app. at first i tried to create a point and it works and then i tried to create a shape based on this tutorial but it doesnt give me any shape. i want to create a shape from those points

here’s my html code

<!DOCTYPE html>
<html lang="en">
  <script src=""></script> 
  <script src=''></script>
  <link href="" rel="stylesheet">
  <link href="style.css" rel="stylesheet">
  <div id="measureContainer"></div>
  <div id="cesiumContainer"></div>
 Cesium.Ion.defaultAccessToken = "cesium-token";
var viewer = new Cesium.Viewer("cesiumContainer", {
  selectionIndicator: false,
  infoBox: false,
var scene = viewer.scene;
var handler;

var modelEntity = viewer.entities.add({
  name: "milktruck",
  position: Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706),
  model: {


// ini untuk menambahkan dot putih ketika hover mouse
function createPoint(worldPosition) {
  var point = viewer.entities.add({
    position: worldPosition,
    point: {
      color: Cesium.Color.WHITE,
      pixelSize: 10,
  return point;
function createShape(worldPosition) {
  var shape = viewer.entities.add({
      polygon: {
        hierarchy: worldPosition,
        material: new Cesium.ColorMaterialProperty(
  return shape
vortex = []
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function (click) {
  var earthPosition = viewer.scene.pickPosition(click.position);
  var dynamicPositions = new Cesium.CallbackProperty(function () { 
          return new Cesium.PolygonHierarchy(vortex);
, Cesium.ScreenSpaceEventType.LEFT_CLICK);


what should i do? thanks in advance

Hello @Ahyar ,
In last time I also work with similar task (but for me needed draw up to pointClouds data - but this NDA project)
For me helped this link:

General flow - need detect different object position and dependences from this use different methods get pick coords.
I hope this will helpful for you.
Sorry my english & happy Holidays

1 Like

thanks for your reply, i’m gonna check this

One other thing to keep in mind is that the tutorial example shared in the original post is likely adding an overlay Cesium World Terrain, not a glTF file (./kotak_ifc_gltf.glb). This may impact the implementation/performance.

I thought gltf is just the same as glb. Btw I’ve solved it by adding perPositionHeight as true on the polygon object

1 Like