Thickness of lines using THREE.LineBasicMaterial

后端 未结 8 1507
小鲜肉
小鲜肉 2020-11-27 06:53

I am using the code below to create hundreds of lines in my three.js scene

edgeGeometry[i] = new THREE.Geometry();
edgeGeometry[i].vertices[0] = v(x1,y1,z1);         


        
相关标签:
8条回答
  • 2020-11-27 07:17

    I use TubeGeometry to create a Thick line between two points:

    See Green lines in Helix

    // line material
    var lineMaterial = new THREE.LineBasicMaterial({ color: 0x00ff00 });
    
    
    let startVector = new THREE.Vector3(
        RADI * Math.cos(t),
        RADI * Math.sin(t),
        3 * t
      );
      let endVector = new THREE.Vector3(
        RADI * Math.cos(t + 10),
        RADI * Math.sin(t + 10),
        3 * t
      );
    
      let linePoints = [];
      linePoints.push(startVector, endVector);
    
      // Create Tube Geometry
      var tubeGeometry = new THREE.TubeGeometry(
        new THREE.CatmullRomCurve3(linePoints),
        512,// path segments
        0.5,// THICKNESS
        8, //Roundness of Tube
        false //closed
      );
    
      //add buffer geometry
      let tubeBufferGeomtry = new THREE.BufferGeometry().fromGeometry(
        tubeGeometry
      );
    
      let line = new THREE.Line(tubeGeometry, lineMaterial);
      scene.add(line);
    
    0 讨论(0)
  • 2020-11-27 07:20

    Are you using Windows?
    I remember this not working on Windows because it wasn't implemented in ANGLE.

    0 讨论(0)
提交回复
热议问题