4

我在画布上绘制了一堆粒子。我正在使用以下代码:

var geometry = new THREE.Geometry();

nodeSet.forEach(function (value, index) {

    if (value.Name.indexOf("p(") == "0") {
       particle = new THREE.Particle(protien);
    } else { particle = new THREE.Particle(material); }

    particle.ID = value.ID;
    particle.position.x = value.Xpos;// Math.random() * 2 - 1;
    particle.position.y = value.YPos; //Math.random() * 2 - 1;
    particle.position.z = Math.random() * 2 - 1;
    particle.position.normalize();
    particle.position.multiplyScalar(Math.random() * 10 + 450);
    particle.scale.x = particle.scale.y = 5;
    scene.add(particle);

    geometry.vertices.push(particle.position);
});

现在,我想根据particle.ID 绘制一条连接两个粒子的线。有人可以帮助我并指出如何做到这一点的方向吗?

4

0 回答 0