How to render 2D shape of points in three.js? I didnt find any working geometry… I just need to make polygon of points that are in the same plane.
Shape isnt right for that as it supports only 2D coords and I need to use 3D points…
I am using the following code to create shape within the X,Y plane
var squareShape = new THREE.Shape();
squareShape.moveTo( 0,0 );
squareShape.lineTo( 0, 50 );
squareShape.lineTo( 20, 80 );
squareShape.lineTo( 50, 50 );
squareShape.lineTo( 0, 0 );
How to make in work it 3D world? Any solution? like:
squareShape.moveTo( 0,0,0 );
squareShape.lineTo( 0, 50, 50 );
etc
You need to create a geometry with the shapes’ vertices (after extraction) and use triangulation to make the faces.
The code should look something like this: