Skip to content

Commit ec8c586

Browse files
committed
ParticlesHolder model created
1 parent 665d89a commit ec8c586

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import Particle from "./Particle";
2+
3+
export default function ParticlesHolder() {
4+
this.mesh = new THREE.Object3D();
5+
this.particlesInUse = [];
6+
7+
this.spawnParticles = function (pos, density, color, scale) {
8+
const nPArticles = density;
9+
for (let i = 0; i < nPArticles; i++) {
10+
let particle;
11+
if (particlesPool.length) {
12+
particle = particlesPool.pop();
13+
} else {
14+
particle = new Particle();
15+
}
16+
this.mesh.add(particle.mesh);
17+
particle.mesh.visible = true;
18+
const _this = this;
19+
particle.mesh.position.y = pos.y;
20+
particle.mesh.position.x = pos.x;
21+
particle.explode(pos, color, scale);
22+
}
23+
};
24+
}

0 commit comments

Comments
 (0)