I want to create customized n-side Polygon to get the area of the surface , but I cannot connect the last point to the first point. (i mean How can I close the polygon)

Hello everyone

I want to create the n-side polygon which try to select the surface to calculate the area of the surface, but I have problem to connect the last point to the first point to close the polygon, how can I do it?
here is my PG:
https://www.babylonjs-playground.com/#GCMU2G#13

And the second question : I have build 5 side polygon , how can I change it to n-side polygon?
https://www.babylonjs-playground.com/#GCMU2G#13

You could also use Irregular Polygons | Babylon.js Documentation

1 Like

Thank you so mush for your helping :pray: :pray:

Hi @JohnK
Thanks a lot for your recommend. :pray:
I try to use the Polygon but it doesn’t make the polygon, is it possible to see my PG:

https://www.babylonjs-playground.com/#GCMU2G#18

You need to note that CreatePolygon uses points in XZ plane https://www.babylonjs-playground.com/#GCMU2G#19

you can rotate for XY plane https://www.babylonjs-playground.com/#GCMU2G#20

and just have lines https://www.babylonjs-playground.com/#GCMU2G#21

4 Likes

Thank you so much @JohnK . You are great :pray: :pray: :pray: