-1

I'm a beginner in threejs. I nearly read all the examples about particle system in the web , and I observe ParticleSystem and WebGLRenderer or Particle and CanvasRenderer are always used together.So I want to know whether Particle can be used in the WebGLRenderer . I just wish to control every particle's movement in the system with WebGLRenderer .How can I do it?

1 Answers1

0

When you create a particle system you can pass in a geometry. Something like this:

        var geom = new THREE.Geometry();
        var material = new THREE.ParticleBasicMaterial({size:4, vertexColors: true, color:0xffffff});

        for (var x = -5 ; x < 5 ; x++) {
            for (var y = -5 ; y < 5 ; y++) {
                    var particle = new THREE.Vector3(x*10,y*10,0);
                    geom.vertices.push(particle);
                    geom.colors.push(new THREE.Color(Math.random()*0x00ffff));
            }
        }

        var system = new THREE.ParticleSystem(geom,material);
        scene.add(system);

By changing the position of each individual vertices you can move them around.

Jos Dirksen
  • 1,863
  • 14
  • 13