Create Polygon base on Vector3

Hi all,

I’ve tried to create function that able to create polygon based on Vector3 position. But, i still haven’t found the best way to do it.

Below is the code that I made: Create Polygon | Babylon.js Playground (babylonjs.com)

But it’s still not what I want. My expectation is that it could be like this:

I want to ask for advice from friends who have made something similar to this.

Thanks all, have great day

you should check Polygon mesh builder.

1 Like

Hi @MeshSlayer
I’ve tried this method, but because it uses Vector2 while I really want to use the points (Vector3) as a benchmark for making polygons, it’s quite difficult to create a more complex mesh.

hum,

I see that you’re using VertexData to create the custom mesh, I think that’s the right track to follow, maybe you should find how to determine your indices based on a position array …

Polygon triangulation is not really my area of expertise, maybe someone else could help ? I’m sure the internet is full of resources on this subject.

good luck :wink:

1 Like

Why do you need to use a Vector3? At least on the Playground example you showed, the points you passed are 2D.

1 Like

@carolhmj
That’s just an example, in the future I want to be able to make a mesh shaped like a wall or something like that