i use polygonGeomtry create a water polygon
how to animate update this polygon height
set modelMatrix can set it height
but can not animate
Welcome to the community
What is your use case for this project? Also, could you please share a sandcastle demo of what you have so far? This information will help me give you the best possible support
Best,
Sam
let _primitive = cesiumViewer.scene.primitives.add(
new Cesium.Primitive({
geometryInstances: new Cesium.GeometryInstance({
geometry: new Cesium.PolygonGeometry({
polygonHierarchy: new Cesium.PolygonHierarchy(_position4),
vertexFormat: Cesium.EllipsoidSurfaceAppearance.VERTEX_FORMAT,
height: 0.1,
}),
id: "water",
}),
appearance: new Cesium.EllipsoidSurfaceAppearance({
aboveGround: false,
}),
releaseGeometryInstances: false,
})
);
let waterMaterail = new Cesium.Material({
fabric: {
type: "Water",
uniforms: {
normalMap: "./assets/model/shuizha/waterNormals.jpg", //法线纹理图片
frequency: 10000.0,
animationSpeed: 0.01,
amplitude: 6.0,
specularIntensity: 0.8,
baseWaterColor: new Cesium.Color(0, 106 / 255, 180 / 255, 0.6),
blendColor: new Cesium.Color(0, 106 / 255, 180 / 255, 0.6),
},
},
});
_primitive.appearance.material = waterMaterail;
let _height = 0.1
let _interval = setInterval(()=>{
_height += 0.1;
if(_height>3){
clearInterval(_interval);
return;
}
_primitive.geometryInstances.geometry._height = _height;
_primitive.update()
},300)
now I want to use setInterval update _primitive height
so I can get a animate result
but set _primitive height and use _primitive.update() will get a develop error
because update function can not directly call
Thank you very much for sending over this code! Unfortunately, I am having trouble running it on my end. Are you sure that there isn’t any code missing? Sharing a sandcastle demo might be our best option for moving forward. You can create on here:
What exact error are you receiving? Looking forward to hearing back from you!
-Sam