Answer the question
In order to leave comments, you need to log in
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 );
Answer the question
In order to leave comments, you need to log in
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 questionAsk a Question
731 491 924 answers to any question