V
V
Vsevolod Zhdanov2014-07-30 10:59:47
JavaScript
Vsevolod Zhdanov, 2014-07-30 10:59:47

How to access each individual particle in a particle system?

Hello!) I wanted to ask. Here I created a particle system on Three.js:

var particleCount = 1000;
var particles = new THREE.Geometry();
var pMaterial = new THREE.ParticleBasicMaterial( { color: 0xffffff, size: 1} );
for ( p = 0; p < particleCount; p++ ) {
  pX = Math.random() * 10 - 50;
  pY = Math.random() * 10 - 500;
  pZ = Math.random() * 10 - 50;
  var particle = new THREE.Vertex( new THREE.Vector3( pX, pY, pZ ) );
  particles.vertices.push( particle );
}
var particleSystem = new THREE.ParticleSystem( particles, pMaterial );
scene.add( particleSystem );

How to manage individual particles of ParticleSystem? Well, so that, for example, they scatter in different directions, as in an explosion or in one direction, as from a jet engine nozzle. Thanks in advance)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
artnazarov, 2014-07-30
@artnazarov

There is also access to particles.vertices, recalculate the coordinates and request an update from the buffer
Quote from the documentation threejs.org/docs/#Reference/Core/Geometry
.vertices
Array of vertices.
The array of vertices holds every position of points in the model.
To signal an update in this array, Geometry.verticesNeedUpdate needs to be set to true.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question