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">
<head>
<script src="https://cesium.com/downloads/cesiumjs/releases/1.85/Build/Cesium/Cesium.js"></script>
<script src='https://unpkg.com/@turf/turf@6/turf.min.js'></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.85/Build/Cesium/Widgets/widgets.css" rel="stylesheet">
<link href="style.css" rel="stylesheet">
</head>
<body>
<div id="measureContainer"></div>
<div id="cesiumContainer"></div>
<script>
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: {
uri:
"./kotak_ifc_gltf.glb",
},
});
viewer.zoomTo(modelEntity);
// 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(
Cesium.Color.WHITE.withAlpha(0.7)
),
},
});
return shape
}
vortex = []
handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function (click) {
var earthPosition = viewer.scene.pickPosition(click.position);
vortex.push(earthPosition)
var dynamicPositions = new Cesium.CallbackProperty(function () {
return new Cesium.PolygonHierarchy(vortex);
});
createShape(dynamicPositions)
createPoint(earthPosition);
}
, Cesium.ScreenSpaceEventType.LEFT_CLICK);
</script>
</script>
</body>
</html>
what should i do? thanks in advance