Three.js在2个粒子之间画线

时间:2013-01-29 14:07:43

标签: javascript three.js

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

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连接两个粒子的线。有人可以帮助并指出我如何做到这一点的方向?

0 个答案:

没有答案