How to update polygon points?

In the documentation, says that it is possible to update polygon points, but I couldn’t find how to do this.

Can anyone help me?
Thanks

An alternative way of creating polygons Create Parametric Shapes - Babylon.js Documentation

Using this alternative, I may be able to update.

But I also would like to extrude the polygon.

I will look at the extrude Polygon function

For some reason the updatable:true, doesn’t work, when I use your suggestion.

I made this playground, where I could replicate the error, there are 2 meshes instead of one.

Only way is to dispose and create a new polygon

https://playground.babylonjs.com/#4G18GY#104

Reason, polygonMeshBuilder which createPolygon uses creates the vertices of the mesh from the passed points. The created mesh is updatable in that you can change values in the vertex buffer but not by giving new corner points.

Hello,
late but perhaps other solution ?

// BUILD a square shape...
let shape = []
let side = 0.25
let c = {x: 1,y: 0, z: 2}
// build a set of point for a closed square
shape.push(new BABYLON.Vector3(c.x - side,c.y,c.z + side))
shape.push(new BABYLON.Vector3(c.x + side,c.y,c.z + side))
shape.push(new BABYLON.Vector3(c.x + side,c.y,c.z - side))
shape.push(new BABYLON.Vector3(c.x - side,c.y,c.z - side))
shape.push(new BABYLON.Vector3(c.x - side,c.y,c.z + side))
// build polygon...
// !! "updatable" is very important
let polyHdl = BABYLON.MeshBuilder.CreatePolygon(<name>,{shape: shape, updatable: true},scene)

// translate poly
let delta = { x: 1, z: 2}
let vertices = polyHdl.getVerticesData(BABYLON.VertexBuffer.PositionKind)
for( let vi=0; vi < 4; vi++) {
	vertices[vi * 3] += delta.x
	vertices[vi * 3 + 2] += delta.z
}
polyHdl.updateVerticesData(BABYLON.VertexBuffer.PositionKind, vertices)
// in order to be clickable with mouse
polyHdl.refreshBoundingInfo()

Best regards