Polygone in threejs

hello everybody
I wanna know if there is a way to draw a customized polygone in threejs. more specificly, imagine that I have 7 points(x,y) and I want to connect them to each order in order to have a polygone. moreover the number of points may vary each time but the coordination of each will be given by user. I wrote the codes with addPoints() and addLines() and it works but I’m looking for something easier and nicer

Have a look at this example.
It uses THREE.ShapeBufferGeometry().

Or, if you want to have just a polygon of a closed line, then you can use THREE.LineLoop(). https://jsfiddle.net/prisoner849/99hhvqzn/


thanks a lot. lineloop() was very helpful but is there any way to set the linewidth because apparently it dosent work with webGL. actually I’m creating a closed path for car race and I need set line width = 20.

Maybe this example will help then.