threejs-csg icon indicating copy to clipboard operation
threejs-csg copied to clipboard

Strokes show extra lines

Open miao-liu opened this issue 3 years ago • 0 comments

hi,I want to ask a question. When I stroke the mesh obtained after the operation, it shows the lines I don't want, how should I combine csg to solve this problem. Screen Shot 2022-07-10 at 7 37 58 PM

  const material = new MeshBasicMaterial( {color: 0x00ff00} );
  const box = new Mesh(new BoxBufferGeometry(1, 1, 0.1), material);
  box.position.set(0, 0, 0);

  const hole = new Mesh(new BoxBufferGeometry(0.2, 0.2, 1), material);
  hole.position.set(0.1, 0.1, 0);
  

  const csg = new CSG();

  csg.subtract([box, hole]);

  const resultMesh = csg.toMesh();


  const edges = new EdgesGeometry(resultMesh.geometry, 45);
  const wideEdges = new LineSegmentsGeometry().fromEdgesGeometry(edges);
  const mt = new LineMaterial({
    color: 0xff0000,
    linewidth: 2
  });
  mt.resolution.set(window.innerWidth, window.innerHeight);
  const line = new LineSegments2(wideEdges, mt);

  scene.add(line)

miao-liu avatar Jul 10 '22 11:07 miao-liu